Commit 158f62202baa0a600ead9cb6cedb7fcc26c8b877
1 parent
1a60ef56
Exists in
master
and in
22 other branches
Do not stub `user` everytime
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
test/functional/cms_controller_test.rb
| ... | ... | @@ -15,7 +15,6 @@ class CmsControllerTest < ActionController::TestCase |
| 15 | 15 | |
| 16 | 16 | @profile = create_user_with_permission('testinguser', 'post_content') |
| 17 | 17 | login_as :testinguser |
| 18 | - @controller.stubs(:user).returns(@profile) | |
| 19 | 18 | end |
| 20 | 19 | |
| 21 | 20 | attr_reader :profile |
| ... | ... | @@ -601,11 +600,13 @@ class CmsControllerTest < ActionController::TestCase |
| 601 | 600 | |
| 602 | 601 | should 'not make enterprise homepage available to person' do |
| 603 | 602 | @controller.stubs(:profile).returns(profile) |
| 603 | + @controller.stubs(:user).returns(profile) | |
| 604 | 604 | assert_not_includes available_article_types, EnterpriseHomepage |
| 605 | 605 | end |
| 606 | 606 | |
| 607 | 607 | should 'make enterprise homepage available to enterprises' do |
| 608 | 608 | @controller.stubs(:profile).returns(fast_create(Enterprise, :name => 'test_ent', :identifier => 'test_ent')) |
| 609 | + @controller.stubs(:user).returns(profile) | |
| 609 | 610 | assert_includes available_article_types, EnterpriseHomepage |
| 610 | 611 | end |
| 611 | 612 | |
| ... | ... | @@ -838,6 +839,7 @@ class CmsControllerTest < ActionController::TestCase |
| 838 | 839 | |
| 839 | 840 | should 'not offer folder to blog articles' do |
| 840 | 841 | @controller.stubs(:profile).returns(fast_create(Enterprise, :name => 'test_ent', :identifier => 'test_ent')) |
| 842 | + @controller.stubs(:user).returns(profile) | |
| 841 | 843 | blog = Blog.create!(:name => 'Blog for test', :profile => profile) |
| 842 | 844 | @controller.stubs(:params).returns({ :parent_id => blog.id }) |
| 843 | 845 | |
| ... | ... | @@ -846,6 +848,7 @@ class CmsControllerTest < ActionController::TestCase |
| 846 | 848 | |
| 847 | 849 | should 'not offer rssfeed to blog articles' do |
| 848 | 850 | @controller.stubs(:profile).returns(fast_create(Enterprise, :name => 'test_ent', :identifier => 'test_ent')) |
| 851 | + @controller.stubs(:user).returns(profile) | |
| 849 | 852 | blog = Blog.create!(:name => 'Blog for test', :profile => profile) |
| 850 | 853 | @controller.stubs(:params).returns({ :parent_id => blog.id }) |
| 851 | 854 | |
| ... | ... | @@ -1203,6 +1206,7 @@ class CmsControllerTest < ActionController::TestCase |
| 1203 | 1206 | |
| 1204 | 1207 | should 'not offer folder to forum articles' do |
| 1205 | 1208 | @controller.stubs(:profile).returns(fast_create(Enterprise, :name => 'test_ent', :identifier => 'test_ent')) |
| 1209 | + @controller.stubs(:user).returns(profile) | |
| 1206 | 1210 | forum = Forum.create!(:name => 'Forum for test', :profile => profile) |
| 1207 | 1211 | @controller.stubs(:params).returns({ :parent_id => forum.id }) |
| 1208 | 1212 | |
| ... | ... | @@ -1211,6 +1215,7 @@ class CmsControllerTest < ActionController::TestCase |
| 1211 | 1215 | |
| 1212 | 1216 | should 'not offer rssfeed to forum articles' do |
| 1213 | 1217 | @controller.stubs(:profile).returns(fast_create(Enterprise, :name => 'test_ent', :identifier => 'test_ent')) |
| 1218 | + @controller.stubs(:user).returns(profile) | |
| 1214 | 1219 | forum = Forum.create!(:name => 'Forum for test', :profile => profile) |
| 1215 | 1220 | @controller.stubs(:params).returns({ :parent_id => forum.id }) |
| 1216 | 1221 | |
| ... | ... | @@ -1501,6 +1506,7 @@ class CmsControllerTest < ActionController::TestCase |
| 1501 | 1506 | |
| 1502 | 1507 | should 'make RawHTMLArticle available only to environment admins' do |
| 1503 | 1508 | @controller.stubs(:profile).returns(profile) |
| 1509 | + @controller.stubs(:user).returns(profile) | |
| 1504 | 1510 | assert_not_includes available_article_types, RawHTMLArticle |
| 1505 | 1511 | profile.environment.add_admin(profile) |
| 1506 | 1512 | assert_includes available_article_types, RawHTMLArticle | ... | ... |