0
0
Fork 0

Keep ENV['LOCAL_HTTPS'] with ApplicationControllerSpec (fix random fail) (#3479)

* Keep ENV['LOCAL_HTTPS'] with ApplicationControllerSpec (fix random fail)

* use climate_control
This commit is contained in:
Yamagishi Kazutoshi 2017-06-01 00:09:17 +09:00 committed by Eugen Rochko
parent c00ead8a72
commit 41fa53253c
4 changed files with 19 additions and 12 deletions

View file

@ -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