From 033b4daf9a2ddd02dc54df999c24aade995aa3c6 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Wed, 28 Sep 2011 23:28:36 +0200 Subject: [PATCH] fix #742. The tests were already there for some time --- features/context_list.feature | 3 ++- features/step_definitions/context_list_steps.rb | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/features/context_list.feature b/features/context_list.feature index e001ca2c..140189b0 100644 --- a/features/context_list.feature +++ b/features/context_list.feature @@ -21,7 +21,7 @@ Feature: Manage the list of contexts And I should see "@boss" And the badge should show 3 - Scenario: Clicking on a project takes me to the context page + Scenario: Clicking on a context takes me to the context page Given I have a context called "@computer" When I go to the contexts page And I follow "@computer" @@ -114,3 +114,4 @@ Feature: Manage the list of contexts Then the new context form should not be visible When I follow "Create a new context" Then the new context form should be visible + diff --git a/features/step_definitions/context_list_steps.rb b/features/step_definitions/context_list_steps.rb index e7906782..b9e52087 100644 --- a/features/step_definitions/context_list_steps.rb +++ b/features/step_definitions/context_list_steps.rb @@ -42,14 +42,6 @@ When /^I add a new hidden context "([^"]*)"$/ do |context_name| submit_new_context_form end -Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low| - high_id = @current_user.contexts.find_by_name(context_high).id - low_id = @current_user.contexts.find_by_name(context_low).id - high_pos = selenium.get_element_position_top("//div[@id='context_#{high_id}']").to_i - low_pos = selenium.get_element_position_top("//div[@id='context_#{low_id}']").to_i - (high_pos < low_pos).should be_true -end - When /^I drag context "([^"]*)" below context "([^"]*)"$/ do |context_drag, context_drop| drag_id = @current_user.contexts.find_by_name(context_drag).id drop_id = @current_user.contexts.find_by_name(context_drop).id @@ -67,6 +59,14 @@ When /^I drag context "([^"]*)" below context "([^"]*)"$/ do |context_drag, cont selenium.mouse_up_at(drop_context_container_xpath,coord_string) end +Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low| + high_id = @current_user.contexts.find_by_name(context_high).id + low_id = @current_user.contexts.find_by_name(context_low).id + high_pos = selenium.get_element_position_top("//div[@id='context_#{high_id}']").to_i + low_pos = selenium.get_element_position_top("//div[@id='context_#{low_id}']").to_i + (high_pos < low_pos).should be_true +end + Then /^I should see that a context named "([^"]*)" is not present$/ do |context_name| Then "I should not see \"#{context_name}\"" end