From 64b33a5dca4bc9f11934a7f091b479aa5112a015 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 6 May 2014 14:19:42 -0300 Subject: [PATCH] rails3: fix cucumber tests --- features/step_definitions/create_community_steps.rb | 6 +++--- features/step_definitions/noosfero_steps.rb | 25 ++++++++++--------------- features/step_definitions/web_steps.rb | 2 +- features/support/env.rb | 5 ----- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/features/step_definitions/create_community_steps.rb b/features/step_definitions/create_community_steps.rb index 2732962..5bd09f9 100644 --- a/features/step_definitions/create_community_steps.rb +++ b/features/step_definitions/create_community_steps.rb @@ -1,7 +1,7 @@ include DatesHelper Given /^I create community "(.+)"$/ do |community| - step %{I go to admin_user's control panel} + Given %{I go to admin_user's control panel} click_link('Manage my groups') click_link('Create a new community') fill_in("Name", :with => community) @@ -10,7 +10,7 @@ end Given /^I approve community "(.+)"$/ do |community| task = CreateCommunity.all.select {|c| c.name == community}.first - step %{I go to admin_user's control panel} + Given %{I go to admin_user's control panel} click_link('Process requests') choose("decision-finish-#{task.id}") first(:button, 'Apply!').click @@ -18,7 +18,7 @@ end Given /^I reject community "(.+)"$/ do |community| task = CreateCommunity.all.select {|c| c.name == community}.first - step %{I go to admin_user's control panel} + Given %{I go to admin_user's control panel} click_link('Process requests') choose("decision-cancel-#{task.id}") first(:button, 'Apply!').click diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index c475166..ba6295b 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -285,18 +285,13 @@ Given /^the following price details?$/ do |table| end Given /^I am logged in as "(.+)"$/ do |username| - step %{I go to logout page} - step %{I go to login page} - step %{I fill in "main_user_login" with "#{username}"} - step %{I fill in "user_password" with "123456"} - step %{I press "Log in"} - # FIXME: - # deveria apenas verificar que esta no myprofile do usuario - # nao conseguir fazer funcionar sem essa reduntancia no capybara - # acho que e algum problema com o http_referer - # olhar account_controller#store_location - step %{I go to #{username}'s control panel} - step %{I should be on #{username}'s control panel} + Given %{I go to logout page} + And %{I go to login page} + And %{I fill in "main_user_login" with "#{username}"} + And %{I fill in "user_password" with "123456"} + When %{I press "Log in"} + And %{I go to #{username}'s control panel} + Then %{I should be on #{username}'s control panel} end Given /^"([^"]*)" is environment admin$/ do |person| @@ -640,9 +635,9 @@ Given /^the following tags$/ do |table| end When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query| - step %{I go to the search #{asset} page} - step %{I fill in "search-input" with "#{query}"} - step %{I press "Search"} + When %{I go to the search #{asset} page} + And %{I fill in "search-input" with "#{query}"} + And %{I press "Search"} end Then /^I should see ([^\"]*)'s product image$/ do |product_name| diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 2692fd1..825bed5 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -63,7 +63,7 @@ end When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields| with_scope(selector) do fields.rows_hash.each do |name, value| - step %{I fill in "#{name}" with "#{value}"} + When %{I fill in "#{name}" with "#{value}"} end end end diff --git a/features/support/env.rb b/features/support/env.rb index b857d38..cf2ae2b 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -55,11 +55,6 @@ end # end # -# Possible values are :truncation and :transaction -# The :transaction strategy is faster, but might give you threading problems. -# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature -Cucumber::Rails::Database.javascript_strategy = :truncation - Cucumber::Rails::World.use_transactional_fixtures = true # How to clean your database when transactions are turned off. See # http://github.com/bmabey/database_cleaner for more info. -- libgit2 0.21.2