diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 18 | ||||
-rw-r--r-- | spec/features/log_in_spec.rb | 9 |
2 files changed, 16 insertions, 11 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 diff --git a/spec/features/log_in_spec.rb b/spec/features/log_in_spec.rb index f9c222b60..6dc3cd2f4 100644 --- a/spec/features/log_in_spec.rb +++ b/spec/features/log_in_spec.rb @@ -1,11 +1,14 @@ require "rails_helper" feature "Log in" do - scenario "A valid email and password user is able to log in" do - email = "test@example.com" - password = "password" + given(:email) { "test@examle.com" } + given(:password) { "password" } + + background do Fabricate(:user, email: email, password: password) + end + scenario "A valid email and password user is able to log in" do visit new_user_session_path fill_in "user_email", with: email fill_in "user_password", with: password |