migrate deleting from selenium to cucumber

please note there is still a bug in context_steps for editing the name of a context from the context page. But I want to get these change in for a bug report
This commit is contained in:
Reinier Balt 2010-02-09 23:26:38 +01:00
parent d945d974a7
commit 25204f5efa
4 changed files with 55 additions and 10 deletions

View file

@ -1,5 +1,5 @@
Given /^I have a context called "([^\"]*)"$/ do |context_name|
@current_user.contexts.create!(:name => context_name)
@context = @current_user.contexts.create!(:name => context_name)
end
When /^I visits the context page for "([^\"]*)"$/ do |context_name|
@ -24,4 +24,24 @@ end
Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
Then "I should not see \"#{context_name}\""
end
end
Given /^I have a context "([^\"]*)" with (.*) actions$/ do |context_name, number_of_actions|
context = @current_user.contexts.create!(:name => context_name)
1.upto number_of_actions.to_i do |i|
@current_user.todos.create!(:context_id => context.id, :description => "todo #{i}")
end
end
When /^I delete the context "([^\"]*)"$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
click_link "delete_context_#{context.id}"
selenium.get_confirmation.should == "Are you sure that you want to delete the context '#{context_name}'?"
end
When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
click_link "edit_context_#{@context.id}"
fill_in "context_name", :with => new_name
click_button "submit_context_#{@context.id}"
end