mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-03 07:48:50 +01:00
get context list scenario passing
This commit is contained in:
parent
c9d64e6f4b
commit
7bce774daa
9 changed files with 29 additions and 36 deletions
|
|
@ -97,12 +97,6 @@ Feature: Manage the list of contexts
|
|||
| active | @phone |
|
||||
| hidden | @hidden |
|
||||
|
||||
@javascript
|
||||
Scenario: Cannot add a context with comma in the name
|
||||
When I go to the contexts page
|
||||
And I add a new active context "foo, bar"
|
||||
Then I should see "Name cannot contain the comma"
|
||||
|
||||
@javascript
|
||||
Scenario: I can drag and drop to order the contexts
|
||||
Given I have the following contexts
|
||||
|
|
|
|||
|
|
@ -70,7 +70,15 @@ Then /^I should see the context name is "([^\"]*)"$/ do |context_name|
|
|||
end
|
||||
|
||||
Then /^he should see that a context named "([^\"]*)" (is|is not) present$/ do |context_name, visible|
|
||||
step "I should #{visible} \"#{context_name}\""
|
||||
context = @current_user.contexts.find_by_name(context_name)
|
||||
if visible == "is"
|
||||
context.should_not be_nil
|
||||
css = "div#context_#{context.id} div.context_description a"
|
||||
page.should have_selector(css, :visible => true)
|
||||
page.find(:css, css).text.should == context_name
|
||||
else
|
||||
page.should_not have_selector("div#context_#{context.id} div.context_description a", :visible => true) if context
|
||||
end
|
||||
end
|
||||
|
||||
Then /^I should (see|not see) empty message for (todo|completed todo|deferred todo)s of context/ do |visible, state|
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Given /^I have no todos$/ do
|
|||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)" in the context "([^"]*)"$/ do |description, context_name|
|
||||
context = @current_user.contexts.find_or_create(:name => context_name)
|
||||
context = @current_user.contexts.find_or_create_by_name(context_name)
|
||||
@todo = @current_user.todos.create!(:context_id => context.id, :description => description)
|
||||
end
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ Given /^I have ([0-9]+) deferred todos$/ do |count|
|
|||
end
|
||||
|
||||
Given /^I have a deferred todo "([^"]*)" in the context "([^"]*)"$/ do |description, context_name|
|
||||
context = @current_user.contexts.find_or_create(:name => context_name)
|
||||
context = @current_user.contexts.find_or_create_by_name(context_name)
|
||||
todo = @current_user.todos.create!(:context_id => context.id, :description => description)
|
||||
todo.show_from = @current_user.time + 1.week
|
||||
todo.save!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue