Commit b05096219fb3b40bf9a4e2c116dcf7ee2b69e0c1
1 parent
6c22b7ef
Exists in
master
and in
29 other branches
Fixing tests that depended on the old layout
Showing
6 changed files
with
20 additions
and
12 deletions
Show diff stats
test/functional/application_controller_test.rb
... | ... | @@ -175,6 +175,7 @@ class ApplicationControllerTest < Test::Unit::TestCase |
175 | 175 | end |
176 | 176 | |
177 | 177 | should 'display only some categories in menu' do |
178 | + @controller.stubs(:get_layout).returns('application') | |
178 | 179 | c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent => nil, :display_in_menu => true ) |
179 | 180 | c2 = Environment.default.categories.create!(:name => 'Category 2', :display_color => nil, :parent => c1, :display_in_menu => true ) |
180 | 181 | get :index |
... | ... | @@ -182,6 +183,7 @@ class ApplicationControllerTest < Test::Unit::TestCase |
182 | 183 | end |
183 | 184 | |
184 | 185 | should 'not display some categories in menu' do |
186 | + @controller.stubs(:get_layout).returns('application') | |
185 | 187 | c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent_id => nil, :display_in_menu => true) |
186 | 188 | c2 = Environment.default.categories.create!(:name => 'Category 2', :display_color => nil, :parent_id => c1) |
187 | 189 | get :index |
... | ... | @@ -198,16 +200,8 @@ class ApplicationControllerTest < Test::Unit::TestCase |
198 | 200 | assert_tag :tag => 'option', :attributes => { :value => 'it' }, :content => 'Italiano' |
199 | 201 | end |
200 | 202 | |
201 | - should 'display links for select language' do | |
202 | - Noosfero.expects(:locales).returns({ 'en' => 'English', 'pt_BR' => 'Português Brasileiro', 'fr' => 'Français', 'it' => 'Italiano' }).at_least_once | |
203 | - get :index, :lang => 'en' | |
204 | - assert_no_tag :tag => 'a', :attributes => { :href => /\?lang=en/ }, :content => 'English' | |
205 | - assert_tag :tag => 'a', :attributes => { :href => /\?lang=pt_BR/ }, :content => 'Português Brasileiro' | |
206 | - assert_tag :tag => 'a', :attributes => { :href => /\?lang=fr/ }, :content => 'Français' | |
207 | - assert_tag :tag => 'a', :attributes => { :href => /\?lang=it/ }, :content => 'Italiano' | |
208 | - end | |
209 | - | |
210 | 203 | should 'display link to webmail if enabled for system and for user' do |
204 | + @controller.stubs(:get_layout).returns('application') | |
211 | 205 | login_as('ze') |
212 | 206 | MailConf.expects(:enabled?).returns(true) |
213 | 207 | MailConf.expects(:webmail_url).returns('http://web.mail/') |
... | ... | @@ -218,6 +212,7 @@ class ApplicationControllerTest < Test::Unit::TestCase |
218 | 212 | end |
219 | 213 | |
220 | 214 | should 'not display link to webmail if not enabled for system' do |
215 | + @controller.stubs(:get_layout).returns('application') | |
221 | 216 | login_as('ze') |
222 | 217 | MailConf.expects(:enabled?).returns(false) |
223 | 218 | |
... | ... | @@ -226,6 +221,7 @@ class ApplicationControllerTest < Test::Unit::TestCase |
226 | 221 | end |
227 | 222 | |
228 | 223 | should 'not display link in menu to webmail if not enabled for user' do |
224 | + @controller.stubs(:get_layout).returns('application') | |
229 | 225 | login_as('ze') |
230 | 226 | MailConf.expects(:enabled?).returns(true) |
231 | 227 | User.any_instance.expects(:enable_email).returns(false) |
... | ... | @@ -389,6 +385,7 @@ class ApplicationControllerTest < Test::Unit::TestCase |
389 | 385 | end |
390 | 386 | |
391 | 387 | should 'display menu links for my environment when logged in other environment' do |
388 | + @controller.stubs(:get_layout).returns('application') | |
392 | 389 | e = Environment.create!(:name => 'other_environment') |
393 | 390 | e.domains << Domain.new(:name => 'other.environment') |
394 | 391 | e.save! | ... | ... |
test/functional/profile_editor_controller_test.rb
... | ... | @@ -410,10 +410,10 @@ class ProfileEditorControllerTest < Test::Unit::TestCase |
410 | 410 | end |
411 | 411 | |
412 | 412 | should 'not link to mailconf for organizations' do |
413 | - MailConf.stubs(:enabled?).returns(true).at_least_once | |
413 | + MailConf.stubs(:enabled?).returns(true) | |
414 | 414 | org = fast_create(Organization) |
415 | 415 | get :index, :profile => org.identifier |
416 | - assert_no_tag :tag => 'a', :attributes => { :href => '/myprofile/testorg/mailconf' } | |
416 | + assert_no_tag :tag => 'a', :attributes => { :href => "/myprofile/#{org.identifier}/mailconf" } | |
417 | 417 | end |
418 | 418 | |
419 | 419 | should 'not link to mailconf if mail not enabled' do | ... | ... |
test/functional/search_controller_test.rb
... | ... | @@ -981,7 +981,7 @@ class SearchControllerTest < Test::Unit::TestCase |
981 | 981 | should 'not display steps when searching not on wizard' do |
982 | 982 | c1 = create_profile_with_optional_category(Community, 'a beautiful community') |
983 | 983 | get :index, :query => 'beautiful', :find_in => [ 'communities' ] |
984 | - assert_equal 'layouts/application', @response.layout | |
984 | + assert_match 'layouts/application', @response.layout | |
985 | 985 | assert_no_tag :tag => 'div', :attributes => {:id => 'wizard-steps'} |
986 | 986 | end |
987 | 987 | ... | ... |
test/integration/assets_menu_test.rb
... | ... | @@ -3,6 +3,9 @@ require "#{File.dirname(__FILE__)}/../test_helper" |
3 | 3 | class AssetsMenuTest < ActionController::IntegrationTest |
4 | 4 | |
5 | 5 | def setup |
6 | + HomeController.any_instance.stubs(:get_layout).returns('application') | |
7 | + SearchController.any_instance.stubs(:get_layout).returns('application') | |
8 | + | |
6 | 9 | parent = Category.create!(:name => "Parent Category", :environment => Environment.default, :display_color => 1) |
7 | 10 | @category = Category.create!(:name => "Category A", :environment => Environment.default, :parent => parent) |
8 | 11 | end | ... | ... |
test/integration/categories_menu_test.rb
... | ... | @@ -3,6 +3,9 @@ require "#{File.dirname(__FILE__)}/../test_helper" |
3 | 3 | class CategoriesMenuTest < ActionController::IntegrationTest |
4 | 4 | |
5 | 5 | def setup |
6 | + HomeController.any_instance.stubs(:get_layout).returns('application') | |
7 | + SearchController.any_instance.stubs(:get_layout).returns('application') | |
8 | + | |
6 | 9 | Category.delete_all |
7 | 10 | @cat1 = Category.create!(:display_in_menu => true, :name => 'Food', :environment => Environment.default, :display_color => 1) |
8 | 11 | @cat2 = Category.create!(:display_in_menu => true, :name => 'Vegetables', :environment => Environment.default, :parent => @cat1) | ... | ... |
test/integration/search_popup_test.rb
... | ... | @@ -2,6 +2,11 @@ require "#{File.dirname(__FILE__)}/../test_helper" |
2 | 2 | |
3 | 3 | class SearchPopupTest < ActionController::IntegrationTest |
4 | 4 | |
5 | + def setup | |
6 | + HomeController.any_instance.stubs(:get_layout).returns('application') | |
7 | + SearchController.any_instance.stubs(:get_layout).returns('application') | |
8 | + end | |
9 | + | |
5 | 10 | should 'link to search without category when not inside a filter' do |
6 | 11 | get '/' |
7 | 12 | assert_tag :tag => 'a', :attributes => { :href => '/search/popup' } | ... | ... |