remove dynamic finders from cucumber scenarios

This commit is contained in:
Reinier Balt 2013-02-27 20:02:01 +01:00
parent 2b2572a2d1
commit 48e47fc009
20 changed files with 133 additions and 134 deletions

View file

@ -1,5 +1,5 @@
When /^I delete project "([^"]*)"$/ do |project_name|
project = @current_user.projects.find_by_name(project_name)
project = @current_user.projects.where(:name => project_name).first
project.should_not be_nil
handle_js_confirm do
@ -13,7 +13,7 @@ When /^I delete project "([^"]*)"$/ do |project_name|
end
When /^I drag the project "([^"]*)" below "([^"]*)"$/ do |project_drag, project_drop|
drag_id = @current_user.projects.find_by_name(project_drag).id
drag_id = @current_user.projects.where(:name => project_drag).first.id
sortable_css = "div.ui-sortable div#container_project_#{drag_id}"
drag_index = project_list_find_index(project_drag)
@ -78,7 +78,7 @@ Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project
end
Then /^the project "([^"]*)" should not be in state list "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.find_by_name(project_name)
project = @current_user.projects.where(:name => project_name).first
project.should_not be_nil
list_id = @source_view=="review" ? "list-#{state}-projects" : "list-#{state_name}-projects-container"
@ -88,7 +88,7 @@ Then /^the project "([^"]*)" should not be in state list "([^"]*)"$/ do |project
end
Then /^the project "([^"]*)" should be in state list "([^"]*)"$/ do |project_name, state_name|
project = @current_user.projects.find_by_name(project_name)
project = @current_user.projects.where(:name => project_name).first
project.should_not be_nil
list_id = @source_view=="review" ? "list-#{state_name}-projects" : "list-#{state_name}-projects-container"
@ -113,15 +113,15 @@ Then /^the new project form should not be visible$/ do
page.should_not have_css("div#project_new", :visible => true)
end
Then /^the project "([^"]*)" should have (\d+) actions listed$/ do |name, count|
project = @current_user.projects.find_by_name(name)
Then /^the project "([^"]*)" should have (\d+) actions listed$/ do |project_name, count|
project = @current_user.projects.where(:name => project_name).first
project.should_not be_nil
xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']//span[@class='needsreview']"
page.find(:xpath, xpath).text.should == "#{project.name} (#{count} actions)"
end
Then /^the project "([^"]*)" should have (\d+) deferred actions listed$/ do |name, deferred|
project = @current_user.projects.find_by_name(name)
Then /^the project "([^"]*)" should have (\d+) deferred actions listed$/ do |project_name, deferred|
project = @current_user.projects.where(:name => project_name).first
project.should_not be_nil
xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']//span[@class='needsreview']"
page.find(:xpath, xpath).text.should == "#{project.name} (#{deferred} deferred actions)"