mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-03 19:40:15 +01:00
Merge pull request #45 from mattr-/show-deferred-if-no-active-actions
Show deferred actions if there are no active actions for project. This will be seen in the project listing and in the sidebar
This commit is contained in:
commit
98a69a5236
3 changed files with 90 additions and 2 deletions
|
|
@ -115,3 +115,27 @@ Feature: Manage the list of projects
|
|||
Then I should see "foo,bar"
|
||||
And the badge should show 4
|
||||
And the project list badge for "active" projects should show 4
|
||||
|
||||
@selenium
|
||||
Scenario: Listing projects with only active actions
|
||||
Given I have a project "do it now" with 2 active todos
|
||||
When I go to the projects page
|
||||
Then the project "do it now" should have 2 actions listed
|
||||
|
||||
@selenium
|
||||
Scenario: Listing projects with both active and deferred actions
|
||||
Given I have a project "now and later" with 2 active actions and 2 deferred actions
|
||||
When I go to the projects page
|
||||
Then the project "now and later" should have 2 actions listed
|
||||
|
||||
@selenium
|
||||
Scenario: Listing projects with only deferred actions
|
||||
Given I have a project "only later" with 3 deferred actions
|
||||
When I go to the projects page
|
||||
Then the project "only later" should have 3 deferred actions listed
|
||||
|
||||
@selenium
|
||||
Scenario: Listing projects with no actions
|
||||
Given I have a project "all done" with 0 active actions and 0 deferred actions
|
||||
When I go to the projects page
|
||||
Then the project "all done" should have 0 actions listed
|
||||
|
|
|
|||
|
|
@ -90,3 +90,52 @@ end
|
|||
Then /^the new project form should not be visible$/ do
|
||||
selenium.is_visible("project_new").should == false
|
||||
end
|
||||
|
||||
|
||||
Given /^I have a project "([^"]*)" with (\d+) active todos$/ do |name, count|
|
||||
@context = @current_user.contexts.find_or_create_by_name("Context A")
|
||||
@project = @current_user.projects.find_or_create_by_name(name)
|
||||
|
||||
@todos=[]
|
||||
1.upto count.to_i do |i|
|
||||
todo = @current_user.todos.create!(
|
||||
:project_id => @project.id,
|
||||
:context_id => @context.id,
|
||||
:description => "todo #{i}")
|
||||
@todos << todo
|
||||
end
|
||||
end
|
||||
|
||||
Then /^the project "([^"]*)" should have (\d+) actions listed$/ do |name, count|
|
||||
project = @current_user.projects.find_by_name(name)
|
||||
project.should_not be_nil
|
||||
xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']//span[@class='needsreview']"
|
||||
selenium.get_text("xpath=#{xpath}").should == "#{project.name} (#{count} actions)"
|
||||
end
|
||||
|
||||
Given /^I have a project "([^"]*)" with (\d+) active actions and (\d+) deferred actions$/ do |name, active_count, deferred_count|
|
||||
Given "I have a project \"#{name}\" with #{active_count} active todos"
|
||||
Given "I have a project \"#{name}\" with #{deferred_count} deferred actions"
|
||||
end
|
||||
|
||||
Given /^I have a project "([^"]*)" with (\d+) deferred actions$/ do |name, deferred|
|
||||
@context = @current_user.contexts.find_or_create_by_name("Context A")
|
||||
@project = @current_user.projects.find_or_create_by_name(name)
|
||||
|
||||
1.upto deferred.to_i do |i|
|
||||
todo = @current_user.todos.create!(
|
||||
:project_id => @project.id,
|
||||
:context_id => @context.id,
|
||||
:description => "deferred todo #{i}")
|
||||
todo.show_from = Time.zone.now + 1.week
|
||||
todo.save!
|
||||
end
|
||||
end
|
||||
|
||||
Then /^the project "([^"]*)" should have (\d+) deferred actions listed$/ do |name, deferred|
|
||||
project = @current_user.projects.find_by_name(name)
|
||||
project.should_not be_nil
|
||||
xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']//span[@class='needsreview']"
|
||||
selenium.get_text("xpath=#{xpath}").should == "#{project.name} (#{deferred} deferred actions)"
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue