Allow for dynamic sprint dates in test Background

pull/6827/head
Mark Maglana 14 years ago
parent 9e19fbc75f
commit eaa9bd3b2d
  1. 3
      features/scrum_master.feature
  2. 3
      features/step_definitions/_given_steps.rb
  3. 11
      features/step_definitions/_then_steps.rb

@ -11,7 +11,7 @@ Feature: Scrum Master
| Sprint 001 | 2010-01-01 | 2010-01-31 |
| Sprint 002 | 2010-02-01 | 2010-02-28 |
| Sprint 003 | 2010-03-01 | 2010-03-31 |
| Sprint 004 | 2010-03-01 | 2010-12-30 |
| Sprint 004 | 2.weeks.ago | 1.week.from_now |
And the project has the following stories in the product backlog:
| position | subject |
| 1 | Story 1 |
@ -49,6 +49,5 @@ Feature: Scrum Master
Scenario: Request the project calendar feed
Given I have set my API access key
And I am viewing the issues list
Then show me the list of stories
When I download the calendar feed
Then the request should complete successfully

@ -104,6 +104,9 @@ Given /^the project has the following sprints:$/ do |table|
@project.versions.delete_all
table.hashes.each do |version|
version['project_id'] = @project.id
['effective_date', 'sprint_start_date'].each do |date_attr|
version[date_attr] = eval(version[date_attr]).strftime("%Y-%m-%d") if version[date_attr].match(/^(\d+)\.(year|month|week|day|hour|minute|second)(s?)\.(ago|from_now)$/)
end
Sprint.create! version
end
end

@ -27,6 +27,17 @@ Then /^I should see the product backlog$/ do
page.should have_css('#product_backlog')
end
Then /^show me the list of sprints$/ do
sprints = Sprint.find(:all, :conditions => "project_id=#{@project.id}")
puts "\n"
puts "\t| #{'id'.ljust(3)} | #{'name'.ljust(18)} | #{'sprint_start_date'.ljust(18)} | #{'effective_date'.ljust(18)} |"
sprints.each do |sprint|
puts "\t| #{sprint.id.to_s.ljust(3)} | #{sprint.name.to_s.ljust(18)} | #{sprint.sprint_start_date.to_s.ljust(18)} | #{sprint.effective_date.to_s.ljust(18)} |"
end
puts "\n\n"
end
Then /^show me the list of stories$/ do
stories = Story.find(:all, :conditions => "project_id=#{@project.id}", :order => "position ASC")
subject_max = (stories.map{|s| s.subject} << "subject").sort{|a,b| a.length <=> b.length}.last.length

Loading…
Cancel
Save