add tests for #886.

This commit is contained in:
Reinier Balt 2010-07-29 18:06:30 +02:00
parent 3d75cd2457
commit c9be43b2c8
5 changed files with 55 additions and 2 deletions

View file

@ -20,6 +20,13 @@ Given /^I have a context "([^\"]*)" with (.*) actions$/ do |context_name, number
end
end
Given /^I have the following contexts$/ do |table|
Context.delete_all
table.hashes.each do |hash|
context = Factory(:context, hash)
end
end
When /^I visit the context page for "([^\"]*)"$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
@ -61,6 +68,17 @@ When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
end
end
When /^I add a new context "([^"]*)"$/ do |context_name|
fill_in "context[name]", :with => context_name
submit_new_context_form
end
When /^I add a new hidden context "([^"]*)"$/ do |context_name|
fill_in "context[name]", :with => context_name
check "context_hide"
submit_new_context_form
end
Then /^I should see the context name is "([^\"]*)"$/ do |context_name|
Then "I should see \"#{context_name}\""
end
@ -71,4 +89,9 @@ end
Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
Then "I should not see \"#{context_name} (\""
end
end
Then /^I should see the context "([^"]*)" under "([^"]*)"$/ do |context_name, state|
context = Context.find_by_name(context_name)
response.should have_xpath("//div[@id='list-contexts-#{state}']//div[@id='context_#{context.id}']")
end