Commit 64b33a5dca4bc9f11934a7f091b479aa5112a015

Authored by Victor Costa
1 parent da1ac64a

rails3: fix cucumber tests

features/step_definitions/create_community_steps.rb
1 include DatesHelper 1 include DatesHelper
2 2
3 Given /^I create community "(.+)"$/ do |community| 3 Given /^I create community "(.+)"$/ do |community|
4 - step %{I go to admin_user's control panel} 4 + Given %{I go to admin_user's control panel}
5 click_link('Manage my groups') 5 click_link('Manage my groups')
6 click_link('Create a new community') 6 click_link('Create a new community')
7 fill_in("Name", :with => community) 7 fill_in("Name", :with => community)
@@ -10,7 +10,7 @@ end @@ -10,7 +10,7 @@ end
10 10
11 Given /^I approve community "(.+)"$/ do |community| 11 Given /^I approve community "(.+)"$/ do |community|
12 task = CreateCommunity.all.select {|c| c.name == community}.first 12 task = CreateCommunity.all.select {|c| c.name == community}.first
13 - step %{I go to admin_user's control panel} 13 + Given %{I go to admin_user's control panel}
14 click_link('Process requests') 14 click_link('Process requests')
15 choose("decision-finish-#{task.id}") 15 choose("decision-finish-#{task.id}")
16 first(:button, 'Apply!').click 16 first(:button, 'Apply!').click
@@ -18,7 +18,7 @@ end @@ -18,7 +18,7 @@ end
18 18
19 Given /^I reject community "(.+)"$/ do |community| 19 Given /^I reject community "(.+)"$/ do |community|
20 task = CreateCommunity.all.select {|c| c.name == community}.first 20 task = CreateCommunity.all.select {|c| c.name == community}.first
21 - step %{I go to admin_user's control panel} 21 + Given %{I go to admin_user's control panel}
22 click_link('Process requests') 22 click_link('Process requests')
23 choose("decision-cancel-#{task.id}") 23 choose("decision-cancel-#{task.id}")
24 first(:button, 'Apply!').click 24 first(:button, 'Apply!').click
features/step_definitions/noosfero_steps.rb
@@ -285,18 +285,13 @@ Given /^the following price details?$/ do |table| @@ -285,18 +285,13 @@ Given /^the following price details?$/ do |table|
285 end 285 end
286 286
287 Given /^I am logged in as "(.+)"$/ do |username| 287 Given /^I am logged in as "(.+)"$/ do |username|
288 - step %{I go to logout page}  
289 - step %{I go to login page}  
290 - step %{I fill in "main_user_login" with "#{username}"}  
291 - step %{I fill in "user_password" with "123456"}  
292 - step %{I press "Log in"}  
293 - # FIXME:  
294 - # deveria apenas verificar que esta no myprofile do usuario  
295 - # nao conseguir fazer funcionar sem essa reduntancia no capybara  
296 - # acho que e algum problema com o http_referer  
297 - # olhar account_controller#store_location  
298 - step %{I go to #{username}'s control panel}  
299 - step %{I should be on #{username}'s control panel} 288 + Given %{I go to logout page}
  289 + And %{I go to login page}
  290 + And %{I fill in "main_user_login" with "#{username}"}
  291 + And %{I fill in "user_password" with "123456"}
  292 + When %{I press "Log in"}
  293 + And %{I go to #{username}'s control panel}
  294 + Then %{I should be on #{username}'s control panel}
300 end 295 end
301 296
302 Given /^"([^"]*)" is environment admin$/ do |person| 297 Given /^"([^"]*)" is environment admin$/ do |person|
@@ -640,9 +635,9 @@ Given /^the following tags$/ do |table| @@ -640,9 +635,9 @@ Given /^the following tags$/ do |table|
640 end 635 end
641 636
642 When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query| 637 When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query|
643 - step %{I go to the search #{asset} page}  
644 - step %{I fill in "search-input" with "#{query}"}  
645 - step %{I press "Search"} 638 + When %{I go to the search #{asset} page}
  639 + And %{I fill in "search-input" with "#{query}"}
  640 + And %{I press "Search"}
646 end 641 end
647 642
648 Then /^I should see ([^\"]*)'s product image$/ do |product_name| 643 Then /^I should see ([^\"]*)'s product image$/ do |product_name|
features/step_definitions/web_steps.rb
@@ -63,7 +63,7 @@ end @@ -63,7 +63,7 @@ end
63 When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields| 63 When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
64 with_scope(selector) do 64 with_scope(selector) do
65 fields.rows_hash.each do |name, value| 65 fields.rows_hash.each do |name, value|
66 - step %{I fill in "#{name}" with "#{value}"} 66 + When %{I fill in "#{name}" with "#{value}"}
67 end 67 end
68 end 68 end
69 end 69 end
features/support/env.rb
@@ -55,11 +55,6 @@ end @@ -55,11 +55,6 @@ end
55 # end 55 # end
56 # 56 #
57 57
58 -# Possible values are :truncation and :transaction  
59 -# The :transaction strategy is faster, but might give you threading problems.  
60 -# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature  
61 -Cucumber::Rails::Database.javascript_strategy = :truncation  
62 -  
63 Cucumber::Rails::World.use_transactional_fixtures = true 58 Cucumber::Rails::World.use_transactional_fixtures = true
64 # How to clean your database when transactions are turned off. See 59 # How to clean your database when transactions are turned off. See
65 # http://github.com/bmabey/database_cleaner for more info. 60 # http://github.com/bmabey/database_cleaner for more info.