Commit 0075cead7047e618c0581e43b35ba4ec122cae4e

Authored by Victor Costa
1 parent 00299ccc

rails3: fix cucumber tests

app/controllers/public/content_viewer_controller.rb
@@ -7,6 +7,7 @@ class ContentViewerController < ApplicationController @@ -7,6 +7,7 @@ class ContentViewerController < ApplicationController
7 7
8 def view_page 8 def view_page
9 path = params[:page] 9 path = params[:page]
  10 + path = "#{path}.#{params[:format]}" if params[:format]
10 @version = params[:version].to_i 11 @version = params[:version].to_i
11 12
12 if path.blank? 13 if path.blank?
@@ -37,7 +38,7 @@ class ContentViewerController < ApplicationController @@ -37,7 +38,7 @@ class ContentViewerController < ApplicationController
37 end 38 end
38 end 39 end
39 40
40 - redirect_to_translation if @page.profile.redirect_l10n 41 + redirect_to_translation and return if @page.profile.redirect_l10n
41 42
42 if request.post? 43 if request.post?
43 if @page.forum? && @page.has_terms_of_use && params[:terms_accepted] == "true" 44 if @page.forum? && @page.has_terms_of_use && params[:terms_accepted] == "true"
@@ -114,7 +115,9 @@ class ContentViewerController < ApplicationController @@ -114,7 +115,9 @@ class ContentViewerController < ApplicationController
114 115
115 if params[:slideshow] 116 if params[:slideshow]
116 render :action => 'slideshow', :layout => 'slideshow' 117 render :action => 'slideshow', :layout => 'slideshow'
  118 + return
117 end 119 end
  120 + render :view_page, :formats => [:html]
118 end 121 end
119 122
120 def article_versions 123 def article_versions
app/helpers/application_helper.rb
@@ -1388,7 +1388,7 @@ module ApplicationHelper @@ -1388,7 +1388,7 @@ module ApplicationHelper
1388 content_tag(:div, :class => 'errorExplanation', :id => 'errorExplanation') do 1388 content_tag(:div, :class => 'errorExplanation', :id => 'errorExplanation') do
1389 content_tag(:h2, _('Errors while saving')) + 1389 content_tag(:h2, _('Errors while saving')) +
1390 content_tag(:ul) do 1390 content_tag(:ul) do
1391 - errors.map { |err| content_tag(:li, err) } 1391 + errors.map { |err| content_tag(:li, err) }.join
1392 end 1392 end
1393 end 1393 end
1394 end 1394 end
app/helpers/forms_helper.rb
@@ -41,6 +41,7 @@ module FormsHelper @@ -41,6 +41,7 @@ module FormsHelper
41 the_class << ' ' << html_options[:class] 41 the_class << ' ' << html_options[:class]
42 end 42 end
43 43
  44 + html_options.delete(:cancel)
44 bt_submit = submit_tag(label, html_options.merge(:class => the_class)) 45 bt_submit = submit_tag(label, html_options.merge(:class => the_class))
45 46
46 bt_submit + bt_cancel 47 bt_submit + bt_cancel
app/models/members_block.rb
1 class MembersBlock < ProfileListBlock 1 class MembersBlock < ProfileListBlock
2 settings_items :show_join_leave_button, :type => :boolean, :default => false 2 settings_items :show_join_leave_button, :type => :boolean, :default => false
3 3
  4 + attr_accessible :show_join_leave_button
  5 +
4 def self.description 6 def self.description
5 _('Members') 7 _('Members')
6 end 8 end
features/browse_catalogs.feature
@@ -17,7 +17,7 @@ Feature: browse catalogs @@ -17,7 +17,7 @@ Feature: browse catalogs
17 And I am on /catalog/artebonito 17 And I am on /catalog/artebonito
18 18
19 Scenario: display titles 19 Scenario: display titles
20 - Then I should see "Associação de Artesanato de Bonito" 20 + Then the page title should be "Associação de Artesanato de Bonito - Colivre.net"
21 And I should see "Products/Services" 21 And I should see "Products/Services"
22 22
23 Scenario: display the simplest possible product 23 Scenario: display the simplest possible product
features/caching.feature
@@ -19,9 +19,9 @@ Feature: caching @@ -19,9 +19,9 @@ Feature: caching
19 | mario | Post1 | Sample Blog | 19 | mario | Post1 | Sample Blog |
20 | mario | Post2 | Sample Blog | 20 | mario | Post2 | Sample Blog |
21 When I go to article "Sample Blog" 21 When I go to article "Sample Blog"
22 - Then I should see "No comments yet" 22 + Then I should see "no comments yet"
23 When I follow "Português" 23 When I follow "Português"
24 - Then I should see "Sem comentários ainda" 24 + Then I should see "sem comentários ainda"
25 25
26 Scenario: blocks 26 Scenario: blocks
27 Given I am on Mario's homepage 27 Given I am on Mario's homepage
features/online_manual.feature
@@ -30,15 +30,15 @@ Feature: online manual @@ -30,15 +30,15 @@ Feature: online manual
30 30
31 Scenario: adding title on browser 31 Scenario: adding title on browser
32 When I go to /doc 32 When I go to /doc
33 - Then I should see "Online Manual - Colivre.net" 33 + Then the page title should be "Online Manual - Colivre.net"
34 34
35 Scenario: adding title on browser in a section 35 Scenario: adding title on browser in a section
36 When I go to /doc 36 When I go to /doc
37 And I follow "User features" 37 And I follow "User features"
38 - Then I should see "User features - Online Manual - Colivre.net" 38 + Then the page title should be "User features - Online Manual - Colivre.net"
39 39
40 Scenario: adding title on browser in a topic 40 Scenario: adding title on browser in a topic
41 When I go to /doc 41 When I go to /doc
42 And I follow "User features" 42 And I follow "User features"
43 And I follow "Commenting articles" 43 And I follow "Commenting articles"
44 - Then I should see "Commenting articles - User features - Online Manual - Colivre.net" 44 + Then the page title should be "Commenting articles - User features - Online Manual - Colivre.net"
features/profile_domain.feature
@@ -55,7 +55,7 @@ Feature: domain for profile @@ -55,7 +55,7 @@ Feature: domain for profile
55 Scenario: access community by domain 55 Scenario: access community by domain
56 Given I go to the search communities page 56 Given I go to the search communities page
57 When I follow "Sample Community" within ".search-profile-item" 57 When I follow "Sample Community" within ".search-profile-item"
58 - Then the page title should be "Sample Community" 58 + Then the page title should be "Sample Community - Colivre.net"
59 59
60 # This test is not working because the community domain isn't at all different 60 # This test is not working because the community domain isn't at all different
61 # from the environment (localhost / 127.0.0.1) 61 # from the environment (localhost / 127.0.0.1)
features/step_definitions/custom_web_steps.rb
@@ -19,7 +19,7 @@ Then /^I should not see &quot;([^&quot;]*)&quot; link$/ do |text| @@ -19,7 +19,7 @@ Then /^I should not see &quot;([^&quot;]*)&quot; link$/ do |text|
19 end 19 end
20 20
21 When /^I should see "([^\"]+)" linking to "([^\"]+)"$/ do |text, href| 21 When /^I should see "([^\"]+)" linking to "([^\"]+)"$/ do |text, href|
22 - page.should have_xpath("//a", :href => /#{href}/) 22 + page.should have_xpath("//a[@href='#{href}']")
23 end 23 end
24 24
25 Then /^the "([^"]*)" button should be disabled$/ do |selector| 25 Then /^the "([^"]*)" button should be disabled$/ do |selector|
features/step_definitions/noosfero_steps.rb
@@ -421,7 +421,7 @@ Given /^enterprise &quot;([^\&quot;]*)&quot; is disabled$/ do |enterprise_name| @@ -421,7 +421,7 @@ Given /^enterprise &quot;([^\&quot;]*)&quot; is disabled$/ do |enterprise_name|
421 end 421 end
422 422
423 Then /^the page title should be "(.*)"$/ do |text| 423 Then /^the page title should be "(.*)"$/ do |text|
424 - step %{I should see "#{text}" within "title"} 424 + page.title.should == text
425 end 425 end
426 426
427 Then /^The page should contain "(.*)"$/ do |selector| 427 Then /^The page should contain "(.*)"$/ do |selector|
@@ -438,9 +438,9 @@ end @@ -438,9 +438,9 @@ end
438 438
439 Given /^the (.+) mail (?:is|has) (.+) (.+)$/ do |position, field, value| 439 Given /^the (.+) mail (?:is|has) (.+) (.+)$/ do |position, field, value|
440 if(/^[0-9]+$/ =~ position) 440 if(/^[0-9]+$/ =~ position)
441 - ActionMailer::Base.deliveries[position.to_i][field] == value 441 + ActionMailer::Base.deliveries[position.to_i][field].to_s == value
442 else 442 else
443 - ActionMailer::Base.deliveries.send(position)[field] == value 443 + ActionMailer::Base.deliveries.send(position)[field].to_s == value
444 end 444 end
445 end 445 end
446 446
features/step_definitions/web_steps.rb
@@ -39,7 +39,7 @@ end @@ -39,7 +39,7 @@ end
39 39
40 When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector| 40 When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
41 with_scope(selector) do 41 with_scope(selector) do
42 - fill_in(field, :with => value) 42 + fill_in(field, :with => value, :match => :prefer_exact)
43 end 43 end
44 end 44 end
45 45
@@ -88,7 +88,7 @@ end @@ -88,7 +88,7 @@ end
88 88
89 When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector| 89 When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
90 with_scope(selector) do 90 with_scope(selector) do
91 - choose(field) 91 + choose(field, :match => :prefer_exact)
92 end 92 end
93 end 93 end
94 94