add done views to projects and recurring todos

This commit is contained in:
Reinier Balt 2011-06-20 06:50:25 +02:00
parent 5496b84642
commit 35f947ec57
13 changed files with 166 additions and 20 deletions

View file

@ -37,6 +37,19 @@ Given /^I have the following projects:$/ do |table|
end
end
Given /^I have a completed project called "([^"]*)"$/ do |project_name|
Given "I have a project called \"#{project_name}\""
@project.complete!
@project.reload
assert @project.completed?
end
Given /^I have (\d+) completed projects$/ do |number_of_projects|
1.upto number_of_projects.to_i do |i|
Given "I have a completed project called \"Project #{i}\""
end
end
Given /^I have no projects$/ do
Project.delete_all
end

View file

@ -26,6 +26,12 @@ Given /^I have a completed repeat pattern "([^"]*)"$/ do |pattern_name|
@recurring_todo.completed?.should be_true
end
Given /^I have (\d+) completed repeat patterns$/ do |number_of_patterns|
1.upto number_of_patterns.to_i do |i|
Given "I have a completed repeat pattern \"Repeating Todo #{i}\""
end
end
When /^I select "([^\"]*)" recurrence pattern$/ do |recurrence_period|
selenium.click("recurring_todo_recurring_period_#{recurrence_period.downcase}")
end

View file

@ -68,7 +68,8 @@ Given /^I have ([0-9]+) completed todos in context "([^"]*)"$/ do |count, contex
end
Given /^I have ([0-9]+) completed todos$/ do |count|
Given "I have #{count} completed todos in the context \"context D\""
Given "I have a context called \"context D\""
Given "I have #{count} completed todos in context \"context D\""
end
Given /^I have ([0-9]+) completed todos with a note$/ do |count|

View file

@ -71,3 +71,42 @@ Feature: Show done
And I should see "Show all"
When I follow "Show all"
Then I should be on the done actions page for project "test"
Scenario: The projects page shows a link to all completed projects
Given I have a completed project called "finished"
When I go to the projects page
Then I should see "finished"
And I should see "Show all"
When I follow "Show all"
Then I should be on the done projects page
And I should see "finished"
Scenario: I can browse all completed projects by page
Given I have 40 completed projects
When I go to the projects page
Then I should see "10 / 40"
When I follow "Show all"
Then I should see the page selector
And I should see "40 (1-20)"
When I follow "2"
Then I should be on the done projects page
And the page should be "2"
Scenario: The recurring todos page shows a link to all completed recurring todos
Given I have a completed repeat pattern "finished"
When I go to the recurring todos page
Then I should see "finished"
And I should see "Show all"
When I follow "Show all"
Then I should be on the done recurring todos page
And I should see "finished"
Scenario: I can browse all completed recurring todos by page
Given I have 40 completed repeat patterns
When I go to the recurring todos page
And I follow "Show all"
Then I should see the page selector
And I should see "40 (1-20)"
When I follow "2"
Then I should be on the done recurring todos page
And the page should be "2"