diff --git a/features/step_definitions/todo_edit_steps.rb b/features/step_definitions/todo_edit_steps.rb index 17077f70..860ba241 100644 --- a/features/step_definitions/todo_edit_steps.rb +++ b/features/step_definitions/todo_edit_steps.rb @@ -64,14 +64,14 @@ end ####### Editing a todo using Edit Form ####### When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field_name, todo_name, new_value| - todo = @current_user.todos.where(:description => todo_name).first - todo.should_not be_nil + todo = find_todo(todo_name) open_edit_form_for(todo) within "form.edit_todo_form" do fill_in "#{field_name}", :with => new_value # force blur event - page.execute_script("$('form.edit_todo_form input.#{field_name}_todo_#{todo.id}').blur();") + execute_javascript("$('form.edit_todo_form input.#{field_name}_todo_#{todo.id}').blur();") + sleep 0.10 end submit_edit_todo_form(todo) wait_for_ajax diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb index c89e8cfd..2db27f0a 100644 --- a/features/step_definitions/todo_steps.rb +++ b/features/step_definitions/todo_steps.rb @@ -138,10 +138,7 @@ Then /^the tag field in the new todo form should be "([^"]*)"$/ do |tag_list| end Then /^the tags of "([^"]*)" should be "([^"]*)"$/ do |todo_description, tag_list| - todo = @current_user.todos.where(:description => todo_description).first - todo.should_not be_nil - - todo.tag_list.should == tag_list + find_todo(todo_description).tag_list.should == tag_list end Then /^I should see "([^"]*)" in the completed section of the mobile site$/ do |desc|