migrate deleting of contexts

This commit is contained in:
Reinier Balt 2010-10-23 17:52:50 +02:00
parent 15fdb1e572
commit e52a8609c7
10 changed files with 124 additions and 31 deletions

View file

@ -36,14 +36,27 @@ When /^I add a new active context "([^"]*)"$/ do |context_name|
When "I add a new context \"#{context_name}\""
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 that a context named "([^"]*)" is not present$/ do |context_name|
Then "I should not see \"#{context_name}\""
end
Then /^I should see that the context container for (.*) contexts is not present$/ do |state|
present = selenium.is_element_present("list-contexts-#{state}'")
present.should_not be_true
end
Then /^I should see the context "([^"]*)" under "([^"]*)"$/ do |context_name, state|
context = Context.find_by_name(context_name)
context.should_not be_nil
response.should have_xpath("//div[@id='list-contexts-#{state}']//div[@id='context_#{context.id}']")
end
Then /^the context list badge for ([^"]*) contexts should show (\d+)$/ do |state_name, count|
selenium.get_text("xpath=//span[@id='#{state_name}-contexts-count']").should == count
end

View file

@ -3,14 +3,28 @@ Given /^I have no contexts$/ do
Context.delete_all
end
Given /^there exists a context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
Given /^there exists an active context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
user = User.find_by_login(login)
user.should_not be_nil
@context = user.contexts.create!(:name => context_name)
@context = user.contexts.create!(:name => context_name, :hide => false)
end
Given /^there exists a hidden context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
user = User.find_by_login(login)
user.should_not be_nil
@context = user.contexts.create!(:name => context_name, :hide => true)
end
Given /^I have a context called "([^\"]*)"$/ do |context_name|
Given "there exists a context called \"#{context_name}\" for user \"#{@current_user.login}\""
Given "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
end
Given /^I have an active context called "([^\"]*)"$/ do |context_name|
Given "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
end
Given /^I have a hidden context called "([^\"]*)"$/ do |context_name|
Given "there exists a hidden context called \"#{context_name}\" for user \"#{@current_user.login}\""
end
Given /^I have the following contexts:$/ do |table|