diff options
author | Maxime Besson <maxime.besson@smile.fr> | 2017-03-23 16:49:59 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-06-02 21:00:11 +0300 |
commit | 9326d896238dd82bf5b8b1a3bc7913b8f03b5c98 (patch) | |
tree | c47c4711e1944ebe5f0477e004dd8d8c5c8103b9 /spec/controllers | |
parent | 1e8dbd46758d5c9772baf233ebcff889dc742d3d (diff) |
Allow manual bypass of auto_sign_in_with_provider
This commit lets a user bypass the automatic signin on the login form,
in order to login with a technical (admin, etc) account
Closes #3786
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/sessions_controller_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index 038132cffe0..e87e24a33a1 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -1,6 +1,37 @@ require 'spec_helper' describe SessionsController do + describe '#new' do + before do + @request.env['devise.mapping'] = Devise.mappings[:user] + end + + context 'when auto sign-in is enabled' do + before do + stub_omniauth_setting(auto_sign_in_with_provider: :saml) + allow(controller).to receive(:omniauth_authorize_path).with(:user, :saml). + and_return('/saml') + end + + context 'and no auto_sign_in param is passed' do + it 'redirects to :omniauth_authorize_path' do + get(:new) + + expect(response).to have_http_status(302) + expect(response).to redirect_to('/saml') + end + end + + context 'and auto_sign_in=false param is passed' do + it 'responds with 200' do + get(:new, auto_sign_in: 'false') + + expect(response).to have_http_status(200) + end + end + end + end + describe '#create' do before do @request.env['devise.mapping'] = Devise.mappings[:user] |