diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-06-03 00:37:17 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-06-03 00:37:17 +0300 |
commit | 8f7fc44b63f728d4de9c2e57a1452c53fa02a642 (patch) | |
tree | 8cc38fcb34c604e209e248e6d2c302374a4f7d9e /spec/controllers | |
parent | 3c63ac4c9ecc71d78239a1a6c53b1c49d4092ea4 (diff) | |
parent | 9326d896238dd82bf5b8b1a3bc7913b8f03b5c98 (diff) |
Merge branch 'mabes/gitlab-ce-bypass-auto-login' into 'master'
Allow manual bypass of auto_sign_in_with_provider
Closes #3786
See merge request !11884
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] |