about summary refs log tree commit diff
path: root/spec/controllers/application_controller_spec.rb
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-06-01 00:09:17 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-31 17:09:17 +0200
commit41fa53253c09f70f4830e10b86d51d5dfb0b5fa9 (patch)
treeb294335ce2c883d05f5dd79234270b1b5fe83acd /spec/controllers/application_controller_spec.rb
parentc00ead8a72dd738013b8a132eff7de4959e59670 (diff)
Keep ENV['LOCAL_HTTPS'] with ApplicationControllerSpec (fix random fail) (#3479)
* Keep ENV['LOCAL_HTTPS'] with ApplicationControllerSpec (fix random fail)

* use climate_control
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r--spec/controllers/application_controller_spec.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 1b209feb5..83ec02401 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -39,18 +39,20 @@ describe ApplicationController, type: :controller do
 
   it "does not force ssl if LOCAL_HTTPS is not 'true'" do
     routes.draw { get 'success' => 'anonymous#success' }
-    ENV['LOCAL_HTTPS'] = ''
-    allow(Rails.env).to receive(:production?).and_return(true)
-    get 'success'
-    expect(response).to have_http_status(:success)
+    ClimateControl.modify LOCAL_HTTPS: '' do
+      allow(Rails.env).to receive(:production?).and_return(true)
+      get 'success'
+      expect(response).to have_http_status(:success)
+    end
   end
 
   it "forces ssl if LOCAL_HTTPS is 'true'" do
     routes.draw { get 'success' => 'anonymous#success' }
-    ENV['LOCAL_HTTPS'] = 'true'
-    allow(Rails.env).to receive(:production?).and_return(true)
-    get 'success'
-    expect(response).to redirect_to('https://test.host/success')
+    ClimateControl.modify LOCAL_HTTPS: 'true' do
+      allow(Rails.env).to receive(:production?).and_return(true)
+      get 'success'
+      expect(response).to redirect_to('https://test.host/success')
+    end
   end
 
   describe 'helper_method :current_account' do