Commit 4b0c037f0cd2a96e00822c8a5aeeab1004bc3748

Authored by Rodrigo Souto
1 parent 2e6acc56

Using assigns on trusted sites tests

test/functional/trusted_sites_controller_test.rb
... ... @@ -33,21 +33,21 @@ class TrustedSitesControllerTest < ActionController::TestCase
33 33 should 'create site' do
34 34 post :create, :site => 'new.site.com'
35 35 assert_redirected_to :action => :index
36   - assert @controller.environment.trusted_sites_for_iframe.include?('new.site.com'), 'Site was not included in the trusted_sites'
  36 + assert assigns(:environment).trusted_sites_for_iframe.include?('new.site.com'), 'Site was not included in the trusted_sites'
37 37 end
38 38  
39 39 should 'fail creation gracefully' do
40 40 @controller.stubs(:add_trusted_site).returns(false)
41 41 post :create, :site => 'new.site.com'
42 42 assert_response :success # it actually failed, but was not redirected
43   - assert !@controller.environment.trusted_sites_for_iframe.include?('new.site.com'), 'Site was included in the trusted_sites!?'
  43 + assert !assigns(:environment).trusted_sites_for_iframe.include?('new.site.com'), 'Site was included in the trusted_sites!?'
44 44 end
45 45  
46 46 should 'destroy site' do
47 47 post :create, :site => 'todel.site.com'
48 48 delete :destroy, :site => 'todel.site.com'
49 49 assert_redirected_to :action => :index
50   - assert ! @controller.environment.trusted_sites_for_iframe.include?('todel.site.com'), 'Site was not removed from trusted_sites'
  50 + assert ! assigns(:environment).trusted_sites_for_iframe.include?('todel.site.com'), 'Site was not removed from trusted_sites'
51 51 end
52 52  
53 53 should "get edit" do
... ... @@ -64,8 +64,8 @@ class TrustedSitesControllerTest < ActionController::TestCase
64 64 post :create, :site => 'toedit.site.com'
65 65 post :update, :orig_site => 'toedit.site.com', :site => 'edited.site.com'
66 66 assert_redirected_to :action => :edit
67   - assert ! @controller.environment.trusted_sites_for_iframe.include?('toedit.site.com'), 'Original site found. Site was not updated?'
68   - assert @controller.environment.trusted_sites_for_iframe.include?('edited.site.com'), 'New name for site not found. Site was not updated?'
  67 + assert ! assigns(:environment).trusted_sites_for_iframe.include?('toedit.site.com'), 'Original site found. Site was not updated?'
  68 + assert assigns(:environment).trusted_sites_for_iframe.include?('edited.site.com'), 'New name for site not found. Site was not updated?'
69 69 end
70 70  
71 71 should 'fail update gracefully' do
... ... @@ -73,7 +73,7 @@ class TrustedSitesControllerTest < ActionController::TestCase
73 73 post :create, :site => 'toedit.site.com'
74 74 post :update, :orig_site => 'toedit.site.com', :site => 'edited.site.com'
75 75 assert_response :success # it actually failed, but was not redirected
76   - assert @controller.environment.trusted_sites_for_iframe.include?('toedit.site.com'), 'Original site not found. Site was updated?'
77   - assert !@controller.environment.trusted_sites_for_iframe.include?('edited.site.com'), 'New name for site found. Site was updated?'
  76 + assert assigns(:environment).trusted_sites_for_iframe.include?('toedit.site.com'), 'Original site not found. Site was updated?'
  77 + assert !assigns(:environment).trusted_sites_for_iframe.include?('edited.site.com'), 'New name for site found. Site was updated?'
78 78 end
79 79 end
... ...