Added a team_lead fixture for use during tests. Added team leads to the
list of users who can edit a sprint. This solves multiple tickets
related to team leads change the sprint status.
Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
app/models/sprint.rb | 2 +-
doc/ChangeLog | 4 ++++
test/fixtures/sprints.yml | 6 +++---
test/fixtures/user_privileges.yml | 3 +++
test/fixtures/users.yml | 7 +++++++
test/unit/sprint_test.rb | 13 +++++++++++++
6 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/app/models/sprint.rb b/app/models/sprint.rb
index 596580e..f2cb1f9 100644
--- a/app/models/sprint.rb
+++ b/app/models/sprint.rb
@@ -122,7 +122,7 @@ class Sprint < ActiveRecord::Base
# Returns whether the specified user can modify this sprint.
def can_edit?(user)
- user && (user.id == product.owner.id)
+ user && ((user.id == product.owner.id) || (user.id == team_lead.id))
end
# Returns whether the user can delete the current sprint.
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 7e2abdc..17fd679 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -5,4 +5,8 @@ Change Log (0.2.0):
* #100 - Team leads can reopen items. - Darryl L. Pierce <mcpierce(a)gmail.com>
* #125 - Added a system title to all pages. - Darryl L. Pierce
<mcpierce(a)gmail.com>
* #131 - Admins can filter out unapproved projects. - Darryl L. Pierce
<mcpierce(a)gmail.com>
+ * #132 - Team leads can start sprints. - Darryl L. Pierce <mcpierce(a)gmail.com>
+ * #133 - Team leads can cancel sprints - Darryl L. Pierce <mcpierce(a)gmail.com>
+ * #134 - Team leads can move a sprint back to planning. - Darryl L. Pierce
<mcpierce(a)gmail.com>
* #136 - System title can be changed by the admin. - Darryl L. Pierce
<mcpierce(a)gmail.com>
+ * #140 - Team leads can complete a sprint. - Darryl L. Pierce
<mcpierce(a)gmail.com>
diff --git a/test/fixtures/sprints.yml b/test/fixtures/sprints.yml
index 704c0c0..e6263c3 100644
--- a/test/fixtures/sprints.yml
+++ b/test/fixtures/sprints.yml
@@ -5,7 +5,7 @@ active_sprint:
duration: 28
goals: Get things done.
status: <%= Sprint::STATUS_ACTIVE %>
- team_lead_id: <%= Fixtures.identify(:projxp_owner) %>
+ team_lead_id: <%= Fixtures.identify(:team_lead) %>
inactive_sprint:
product_id: <%= Fixtures.identify(:projxp_web) %>
@@ -14,7 +14,7 @@ inactive_sprint:
duration: 28
goals: Got stuff done.
status: <%= Sprint::STATUS_PLANNED %>
- team_lead_id: <%= Fixtures.identify(:projxp_owner) %>
+ team_lead_id: <%= Fixtures.identify(:team_lead) %>
closed_sprint:
product_id: <%= Fixtures.identify(:projxp_web) %>
@@ -23,4 +23,4 @@ closed_sprint:
duration: 28
goals: Get more stuff done.
status: <%= Sprint::STATUS_CLOSED %>
- team_lead_id: <%= Fixtures.identify(:projxp_owner) %>
+ team_lead_id: <%= Fixtures.identify(:team_lead) %>
diff --git a/test/fixtures/user_privileges.yml b/test/fixtures/user_privileges.yml
index 0ca79ac..1c9476c 100644
--- a/test/fixtures/user_privileges.yml
+++ b/test/fixtures/user_privileges.yml
@@ -17,6 +17,9 @@ projxp_owner_privileges:
admin_projects: false
admin_users: false
+team_lead:
+ user_id: <%= Fixtures.identify(:team_lead) %>
+
teatime_owner_privileges:
user_id: <%= Fixtures.identify(:teatime_owner) %>
admin_projects: false
diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml
index 9981281..2738441 100644
--- a/test/fixtures/users.yml
+++ b/test/fixtures/users.yml
@@ -21,6 +21,13 @@ projxp_owner:
salt: <%= SALT %>
hashed_password: <%= User.encrypted_password('bonk', SALT) %>
+team_lead:
+ email: team_lead(a)projxp.org
+ display_name: Team Lead
+ introduction: I'm the team lead.
+ salt: <%= SALT %>
+ hashed_password: <%= User.encrypted_password('team lead', SALT) %>
+
teatime_owner:
email: admin(a)teatime.org
display_name: Teatime Admin
diff --git a/test/unit/sprint_test.rb b/test/unit/sprint_test.rb
index 9150dea..43c2f47 100644
--- a/test/unit/sprint_test.rb
+++ b/test/unit/sprint_test.rb
@@ -43,6 +43,9 @@ class SprintTest < ActiveSupport::TestCase
@unhealthy_backlog = [ backlog_item ]
@existing_sprint = sprints(:active_sprint)
+ @team_lead = @existing_sprint.team_lead
+ @owner = @product.owner
+ raise "Team lead and product owner cannot be the same user!" if
@team_lead.id == @owner.id
end
# Ensures that a sprint has to have a product.
@@ -133,4 +136,14 @@ class SprintTest < ActiveSupport::TestCase
assert_equal @new_sprint.start + (@new_sprint.duration - 1), @new_sprint.end_date,
"End date calculation is wrong."
end
+
+ # Ensures that a team lead can edit a sprint.
+ def test_edit_as_team_lead
+ flunk "Team leads must be allowed to edit sprints." unless
@existing_sprint.can_edit?(@team_lead)
+ end
+
+ # Ensures that a product owner can edit a sprint.
+ def test_edit_as_product_owner
+ flunk "Product owners must be allowed to edit sprints." unless
@existing_sprint.can_edit?(@owner)
+ end
end
--
1.6.0.6
Show replies by thread
On Fri, Mar 27, 2009 at 9:46 AM, Darryl L. Pierce <mcpierce(a)gmail.com> wrote:
Added a team_lead fixture for use during tests. Added team leads to
the
list of users who can edit a sprint. This solves multiple tickets
related to team leads change the sprint status.
Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
This patch also solves #135.
--
Darryl L. Pierce <mcpierce(a)gmail.com>
Visit the Infobahn Offramp: <
http://mcpierce.multiply.com>
"Bury me next to my wife. Nothing too fancy..." - Ulysses S. Grant
On Fri, Mar 27, 2009 at 9:46 AM, Darryl L. Pierce <mcpierce(a)gmail.com> wrote:
Added a team_lead fixture for use during tests. Added team leads to
the
list of users who can edit a sprint. This solves multiple tickets
related to team leads change the sprint status.
Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
Pushed.
--
Darryl L. Pierce <mcpierce(a)gmail.com>
Visit the Infobahn Offramp: <
http://mcpierce.multiply.com>
"Bury me next to my wife. Nothing too fancy..." - Ulysses S. Grant