summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/omniauth_initializer_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/omniauth_initializer_spec.rb')
-rw-r--r--spec/lib/gitlab/omniauth_initializer_spec.rb52
1 files changed, 18 insertions, 34 deletions
diff --git a/spec/lib/gitlab/omniauth_initializer_spec.rb b/spec/lib/gitlab/omniauth_initializer_spec.rb
index 563c97fa2cb..daef280dbaa 100644
--- a/spec/lib/gitlab/omniauth_initializer_spec.rb
+++ b/spec/lib/gitlab/omniauth_initializer_spec.rb
@@ -189,7 +189,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
it 'passes "args" hash as symbolized hash argument' do
hash_config = { 'name' => 'hash', 'args' => { 'custom' => 'format' } }
- expect(devise_config).to receive(:omniauth).with(:hash, custom: 'format')
+ expect(devise_config).to receive(:omniauth).with(:hash, { custom: 'format' })
subject.execute([hash_config])
end
@@ -197,7 +197,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
it 'normalizes a String strategy_class' do
hash_config = { 'name' => 'hash', 'args' => { strategy_class: 'OmniAuth::Strategies::OAuth2Generic' } }
- expect(devise_config).to receive(:omniauth).with(:hash, strategy_class: OmniAuth::Strategies::OAuth2Generic)
+ expect(devise_config).to receive(:omniauth).with(:hash, { strategy_class: OmniAuth::Strategies::OAuth2Generic })
subject.execute([hash_config])
end
@@ -205,7 +205,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
it 'allows a class to be specified in strategy_class' do
hash_config = { 'name' => 'hash', 'args' => { strategy_class: OmniAuth::Strategies::OAuth2Generic } }
- expect(devise_config).to receive(:omniauth).with(:hash, strategy_class: OmniAuth::Strategies::OAuth2Generic)
+ expect(devise_config).to receive(:omniauth).with(:hash, { strategy_class: OmniAuth::Strategies::OAuth2Generic })
subject.execute([hash_config])
end
@@ -216,26 +216,10 @@ RSpec.describe Gitlab::OmniauthInitializer do
expect { subject.execute([hash_config]) }.to raise_error(NameError)
end
- it 'configures fail_with_empty_uid for shibboleth' do
- shibboleth_config = { 'name' => 'shibboleth', 'args' => {} }
-
- expect(devise_config).to receive(:omniauth).with(:shibboleth, fail_with_empty_uid: true)
-
- subject.execute([shibboleth_config])
- end
-
- it 'configures remote_sign_out_handler proc for authentiq' do
- authentiq_config = { 'name' => 'authentiq', 'args' => {} }
-
- expect(devise_config).to receive(:omniauth).with(:authentiq, remote_sign_out_handler: an_instance_of(Proc))
-
- subject.execute([authentiq_config])
- end
-
it 'configures on_single_sign_out proc for cas3' do
cas3_config = { 'name' => 'cas3', 'args' => {} }
- expect(devise_config).to receive(:omniauth).with(:cas3, on_single_sign_out: an_instance_of(Proc))
+ expect(devise_config).to receive(:omniauth).with(:cas3, { on_single_sign_out: an_instance_of(Proc) })
subject.execute([cas3_config])
end
@@ -247,11 +231,11 @@ RSpec.describe Gitlab::OmniauthInitializer do
}
expect(devise_config).to receive(:omniauth).with(
- :google_oauth2,
- access_type: "offline",
- approval_prompt: "",
- client_options: { connection_opts: { request: { timeout: Gitlab::OmniauthInitializer::OAUTH2_TIMEOUT_SECONDS } } }
- )
+ :google_oauth2, {
+ access_type: "offline",
+ approval_prompt: "",
+ client_options: { connection_opts: { request: { timeout: Gitlab::OmniauthInitializer::OAUTH2_TIMEOUT_SECONDS } } }
+ })
subject.execute([google_config])
end
@@ -263,10 +247,10 @@ RSpec.describe Gitlab::OmniauthInitializer do
}
expect(devise_config).to receive(:omniauth).with(
- :gitlab,
- client_options: { site: conf.dig('args', 'client_options', 'site') },
- authorize_params: { gl_auth_type: 'login' }
- )
+ :gitlab, {
+ client_options: { site: conf.dig('args', 'client_options', 'site') },
+ authorize_params: { gl_auth_type: 'login' }
+ })
subject.execute([conf])
end
@@ -275,9 +259,9 @@ RSpec.describe Gitlab::OmniauthInitializer do
conf = { 'name' => 'gitlab' }
expect(devise_config).to receive(:omniauth).with(
- :gitlab,
- authorize_params: { gl_auth_type: 'login' }
- )
+ :gitlab, {
+ authorize_params: { gl_auth_type: 'login' }
+ })
subject.execute([conf])
end
@@ -288,7 +272,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
expect(devise_config).to receive(:omniauth).with(
:gitlab,
'a',
- authorize_params: { gl_auth_type: 'login' }
+ { authorize_params: { gl_auth_type: 'login' } }
)
subject.execute([conf])
@@ -303,7 +287,7 @@ RSpec.describe Gitlab::OmniauthInitializer do
expect(devise_config).to receive(:omniauth).with(
:gitlab,
- authorize_params: { gl_auth_type: 'login' }
+ { authorize_params: { gl_auth_type: 'login' } }
)
subject.execute([conf])