From 4b0c037f0cd2a96e00822c8a5aeeab1004bc3748 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Thu, 11 Jul 2013 18:29:37 -0300 Subject: [PATCH] Using assigns on trusted sites tests --- test/functional/trusted_sites_controller_test.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/functional/trusted_sites_controller_test.rb b/test/functional/trusted_sites_controller_test.rb index 07c0e94..bb83bdd 100644 --- a/test/functional/trusted_sites_controller_test.rb +++ b/test/functional/trusted_sites_controller_test.rb @@ -33,21 +33,21 @@ class TrustedSitesControllerTest < ActionController::TestCase should 'create site' do post :create, :site => 'new.site.com' assert_redirected_to :action => :index - assert @controller.environment.trusted_sites_for_iframe.include?('new.site.com'), 'Site was not included in the trusted_sites' + assert assigns(:environment).trusted_sites_for_iframe.include?('new.site.com'), 'Site was not included in the trusted_sites' end should 'fail creation gracefully' do @controller.stubs(:add_trusted_site).returns(false) post :create, :site => 'new.site.com' assert_response :success # it actually failed, but was not redirected - assert !@controller.environment.trusted_sites_for_iframe.include?('new.site.com'), 'Site was included in the trusted_sites!?' + assert !assigns(:environment).trusted_sites_for_iframe.include?('new.site.com'), 'Site was included in the trusted_sites!?' end should 'destroy site' do post :create, :site => 'todel.site.com' delete :destroy, :site => 'todel.site.com' assert_redirected_to :action => :index - assert ! @controller.environment.trusted_sites_for_iframe.include?('todel.site.com'), 'Site was not removed from trusted_sites' + assert ! assigns(:environment).trusted_sites_for_iframe.include?('todel.site.com'), 'Site was not removed from trusted_sites' end should "get edit" do @@ -64,8 +64,8 @@ class TrustedSitesControllerTest < ActionController::TestCase post :create, :site => 'toedit.site.com' post :update, :orig_site => 'toedit.site.com', :site => 'edited.site.com' assert_redirected_to :action => :edit - assert ! @controller.environment.trusted_sites_for_iframe.include?('toedit.site.com'), 'Original site found. Site was not updated?' - assert @controller.environment.trusted_sites_for_iframe.include?('edited.site.com'), 'New name for site not found. Site was not updated?' + assert ! assigns(:environment).trusted_sites_for_iframe.include?('toedit.site.com'), 'Original site found. Site was not updated?' + assert assigns(:environment).trusted_sites_for_iframe.include?('edited.site.com'), 'New name for site not found. Site was not updated?' end should 'fail update gracefully' do @@ -73,7 +73,7 @@ class TrustedSitesControllerTest < ActionController::TestCase post :create, :site => 'toedit.site.com' post :update, :orig_site => 'toedit.site.com', :site => 'edited.site.com' assert_response :success # it actually failed, but was not redirected - assert @controller.environment.trusted_sites_for_iframe.include?('toedit.site.com'), 'Original site not found. Site was updated?' - assert !@controller.environment.trusted_sites_for_iframe.include?('edited.site.com'), 'New name for site found. Site was updated?' + assert assigns(:environment).trusted_sites_for_iframe.include?('toedit.site.com'), 'Original site not found. Site was updated?' + assert !assigns(:environment).trusted_sites_for_iframe.include?('edited.site.com'), 'New name for site found. Site was updated?' end end -- libgit2 0.21.2