From 0075cead7047e618c0581e43b35ba4ec122cae4e Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 18 Feb 2014 19:24:35 -0300 Subject: [PATCH] rails3: fix cucumber tests --- app/controllers/public/content_viewer_controller.rb | 5 ++++- app/helpers/application_helper.rb | 2 +- app/helpers/forms_helper.rb | 1 + app/models/members_block.rb | 2 ++ features/browse_catalogs.feature | 2 +- features/caching.feature | 4 ++-- features/online_manual.feature | 6 +++--- features/profile_domain.feature | 2 +- features/step_definitions/custom_web_steps.rb | 2 +- features/step_definitions/noosfero_steps.rb | 6 +++--- features/step_definitions/web_steps.rb | 4 ++-- 11 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index a93cece..fb807a8 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -7,6 +7,7 @@ class ContentViewerController < ApplicationController def view_page path = params[:page] + path = "#{path}.#{params[:format]}" if params[:format] @version = params[:version].to_i if path.blank? @@ -37,7 +38,7 @@ class ContentViewerController < ApplicationController end end - redirect_to_translation if @page.profile.redirect_l10n + redirect_to_translation and return if @page.profile.redirect_l10n if request.post? if @page.forum? && @page.has_terms_of_use && params[:terms_accepted] == "true" @@ -114,7 +115,9 @@ class ContentViewerController < ApplicationController if params[:slideshow] render :action => 'slideshow', :layout => 'slideshow' + return end + render :view_page, :formats => [:html] end def article_versions diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 16279d3..06892ff 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1388,7 +1388,7 @@ module ApplicationHelper content_tag(:div, :class => 'errorExplanation', :id => 'errorExplanation') do content_tag(:h2, _('Errors while saving')) + content_tag(:ul) do - errors.map { |err| content_tag(:li, err) } + errors.map { |err| content_tag(:li, err) }.join end end end diff --git a/app/helpers/forms_helper.rb b/app/helpers/forms_helper.rb index e319ace..d6356eb 100644 --- a/app/helpers/forms_helper.rb +++ b/app/helpers/forms_helper.rb @@ -41,6 +41,7 @@ module FormsHelper the_class << ' ' << html_options[:class] end + html_options.delete(:cancel) bt_submit = submit_tag(label, html_options.merge(:class => the_class)) bt_submit + bt_cancel diff --git a/app/models/members_block.rb b/app/models/members_block.rb index 6235053..f47dea8 100644 --- a/app/models/members_block.rb +++ b/app/models/members_block.rb @@ -1,6 +1,8 @@ class MembersBlock < ProfileListBlock settings_items :show_join_leave_button, :type => :boolean, :default => false + attr_accessible :show_join_leave_button + def self.description _('Members') end diff --git a/features/browse_catalogs.feature b/features/browse_catalogs.feature index 83b32df..bee2ae0 100644 --- a/features/browse_catalogs.feature +++ b/features/browse_catalogs.feature @@ -17,7 +17,7 @@ Feature: browse catalogs And I am on /catalog/artebonito Scenario: display titles - Then I should see "Associação de Artesanato de Bonito" + Then the page title should be "Associação de Artesanato de Bonito - Colivre.net" And I should see "Products/Services" Scenario: display the simplest possible product diff --git a/features/caching.feature b/features/caching.feature index 255d9d6..ba2efd9 100644 --- a/features/caching.feature +++ b/features/caching.feature @@ -19,9 +19,9 @@ Feature: caching | mario | Post1 | Sample Blog | | mario | Post2 | Sample Blog | When I go to article "Sample Blog" - Then I should see "No comments yet" + Then I should see "no comments yet" When I follow "Português" - Then I should see "Sem comentários ainda" + Then I should see "sem comentários ainda" Scenario: blocks Given I am on Mario's homepage diff --git a/features/online_manual.feature b/features/online_manual.feature index a20405b..95ae163 100644 --- a/features/online_manual.feature +++ b/features/online_manual.feature @@ -30,15 +30,15 @@ Feature: online manual Scenario: adding title on browser When I go to /doc - Then I should see "Online Manual - Colivre.net" + Then the page title should be "Online Manual - Colivre.net" Scenario: adding title on browser in a section When I go to /doc And I follow "User features" - Then I should see "User features - Online Manual - Colivre.net" + Then the page title should be "User features - Online Manual - Colivre.net" Scenario: adding title on browser in a topic When I go to /doc And I follow "User features" And I follow "Commenting articles" - Then I should see "Commenting articles - User features - Online Manual - Colivre.net" + Then the page title should be "Commenting articles - User features - Online Manual - Colivre.net" diff --git a/features/profile_domain.feature b/features/profile_domain.feature index 1ab0865..eed2d1b 100644 --- a/features/profile_domain.feature +++ b/features/profile_domain.feature @@ -55,7 +55,7 @@ Feature: domain for profile Scenario: access community by domain Given I go to the search communities page When I follow "Sample Community" within ".search-profile-item" - Then the page title should be "Sample Community" + Then the page title should be "Sample Community - Colivre.net" # This test is not working because the community domain isn't at all different # from the environment (localhost / 127.0.0.1) diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 737b5c9..5a177d0 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -19,7 +19,7 @@ Then /^I should not see "([^"]*)" link$/ do |text| end When /^I should see "([^\"]+)" linking to "([^\"]+)"$/ do |text, href| - page.should have_xpath("//a", :href => /#{href}/) + page.should have_xpath("//a[@href='#{href}']") end Then /^the "([^"]*)" button should be disabled$/ do |selector| diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index db55b62..c475166 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -421,7 +421,7 @@ Given /^enterprise "([^\"]*)" is disabled$/ do |enterprise_name| end Then /^the page title should be "(.*)"$/ do |text| - step %{I should see "#{text}" within "title"} + page.title.should == text end Then /^The page should contain "(.*)"$/ do |selector| @@ -438,9 +438,9 @@ end Given /^the (.+) mail (?:is|has) (.+) (.+)$/ do |position, field, value| if(/^[0-9]+$/ =~ position) - ActionMailer::Base.deliveries[position.to_i][field] == value + ActionMailer::Base.deliveries[position.to_i][field].to_s == value else - ActionMailer::Base.deliveries.send(position)[field] == value + ActionMailer::Base.deliveries.send(position)[field].to_s == value end end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 669f2fe..2692fd1 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -39,7 +39,7 @@ end When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector| with_scope(selector) do - fill_in(field, :with => value) + fill_in(field, :with => value, :match => :prefer_exact) end end @@ -88,7 +88,7 @@ end When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector| with_scope(selector) do - choose(field) + choose(field, :match => :prefer_exact) end end -- libgit2 0.21.2