diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index 46f155b..534ecb5 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -175,6 +175,7 @@ class ApplicationControllerTest < Test::Unit::TestCase end should 'display only some categories in menu' do + @controller.stubs(:get_layout).returns('application') c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent => nil, :display_in_menu => true ) c2 = Environment.default.categories.create!(:name => 'Category 2', :display_color => nil, :parent => c1, :display_in_menu => true ) get :index @@ -182,6 +183,7 @@ class ApplicationControllerTest < Test::Unit::TestCase end should 'not display some categories in menu' do + @controller.stubs(:get_layout).returns('application') c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent_id => nil, :display_in_menu => true) c2 = Environment.default.categories.create!(:name => 'Category 2', :display_color => nil, :parent_id => c1) get :index @@ -198,16 +200,8 @@ class ApplicationControllerTest < Test::Unit::TestCase assert_tag :tag => 'option', :attributes => { :value => 'it' }, :content => 'Italiano' end - should 'display links for select language' do - Noosfero.expects(:locales).returns({ 'en' => 'English', 'pt_BR' => 'Português Brasileiro', 'fr' => 'Français', 'it' => 'Italiano' }).at_least_once - get :index, :lang => 'en' - assert_no_tag :tag => 'a', :attributes => { :href => /\?lang=en/ }, :content => 'English' - assert_tag :tag => 'a', :attributes => { :href => /\?lang=pt_BR/ }, :content => 'Português Brasileiro' - assert_tag :tag => 'a', :attributes => { :href => /\?lang=fr/ }, :content => 'Français' - assert_tag :tag => 'a', :attributes => { :href => /\?lang=it/ }, :content => 'Italiano' - end - should 'display link to webmail if enabled for system and for user' do + @controller.stubs(:get_layout).returns('application') login_as('ze') MailConf.expects(:enabled?).returns(true) MailConf.expects(:webmail_url).returns('http://web.mail/') @@ -218,6 +212,7 @@ class ApplicationControllerTest < Test::Unit::TestCase end should 'not display link to webmail if not enabled for system' do + @controller.stubs(:get_layout).returns('application') login_as('ze') MailConf.expects(:enabled?).returns(false) @@ -226,6 +221,7 @@ class ApplicationControllerTest < Test::Unit::TestCase end should 'not display link in menu to webmail if not enabled for user' do + @controller.stubs(:get_layout).returns('application') login_as('ze') MailConf.expects(:enabled?).returns(true) User.any_instance.expects(:enable_email).returns(false) @@ -389,6 +385,7 @@ class ApplicationControllerTest < Test::Unit::TestCase end should 'display menu links for my environment when logged in other environment' do + @controller.stubs(:get_layout).returns('application') e = Environment.create!(:name => 'other_environment') e.domains << Domain.new(:name => 'other.environment') e.save! diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index df99e19..cf081c2 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -410,10 +410,10 @@ class ProfileEditorControllerTest < Test::Unit::TestCase end should 'not link to mailconf for organizations' do - MailConf.stubs(:enabled?).returns(true).at_least_once + MailConf.stubs(:enabled?).returns(true) org = fast_create(Organization) get :index, :profile => org.identifier - assert_no_tag :tag => 'a', :attributes => { :href => '/myprofile/testorg/mailconf' } + assert_no_tag :tag => 'a', :attributes => { :href => "/myprofile/#{org.identifier}/mailconf" } end should 'not link to mailconf if mail not enabled' do diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 09cfa39..337eb43 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -981,7 +981,7 @@ class SearchControllerTest < Test::Unit::TestCase should 'not display steps when searching not on wizard' do c1 = create_profile_with_optional_category(Community, 'a beautiful community') get :index, :query => 'beautiful', :find_in => [ 'communities' ] - assert_equal 'layouts/application', @response.layout + assert_match 'layouts/application', @response.layout assert_no_tag :tag => 'div', :attributes => {:id => 'wizard-steps'} end diff --git a/test/integration/assets_menu_test.rb b/test/integration/assets_menu_test.rb index 6b0daab..133f12b 100644 --- a/test/integration/assets_menu_test.rb +++ b/test/integration/assets_menu_test.rb @@ -3,6 +3,9 @@ require "#{File.dirname(__FILE__)}/../test_helper" class AssetsMenuTest < ActionController::IntegrationTest def setup + HomeController.any_instance.stubs(:get_layout).returns('application') + SearchController.any_instance.stubs(:get_layout).returns('application') + parent = Category.create!(:name => "Parent Category", :environment => Environment.default, :display_color => 1) @category = Category.create!(:name => "Category A", :environment => Environment.default, :parent => parent) end diff --git a/test/integration/categories_menu_test.rb b/test/integration/categories_menu_test.rb index 43408fd..5fa1376 100644 --- a/test/integration/categories_menu_test.rb +++ b/test/integration/categories_menu_test.rb @@ -3,6 +3,9 @@ require "#{File.dirname(__FILE__)}/../test_helper" class CategoriesMenuTest < ActionController::IntegrationTest def setup + HomeController.any_instance.stubs(:get_layout).returns('application') + SearchController.any_instance.stubs(:get_layout).returns('application') + Category.delete_all @cat1 = Category.create!(:display_in_menu => true, :name => 'Food', :environment => Environment.default, :display_color => 1) @cat2 = Category.create!(:display_in_menu => true, :name => 'Vegetables', :environment => Environment.default, :parent => @cat1) diff --git a/test/integration/search_popup_test.rb b/test/integration/search_popup_test.rb index abc6163..e025219 100644 --- a/test/integration/search_popup_test.rb +++ b/test/integration/search_popup_test.rb @@ -2,6 +2,11 @@ require "#{File.dirname(__FILE__)}/../test_helper" class SearchPopupTest < ActionController::IntegrationTest + def setup + HomeController.any_instance.stubs(:get_layout).returns('application') + SearchController.any_instance.stubs(:get_layout).returns('application') + end + should 'link to search without category when not inside a filter' do get '/' assert_tag :tag => 'a', :attributes => { :href => '/search/popup' } -- libgit2 0.21.2