diff options
author | dodocat <jingqq5210@gmail.com> | 2019-08-27 06:46:32 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2019-08-27 06:46:32 +0300 |
commit | 6e2032f24e0428189f8c9fe9e296a9630277155e (patch) | |
tree | 79ed8e273c4ee80512a11ca1029cd20426625457 /spec/lib | |
parent | 5e59c919d780441a5605d76e76ce63a69166464d (diff) |
Update docs and comments about saml with allow_bypass_two_factor
allow_bypass_two_factor configration dose not work with saml provider
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/auth/o_auth/user_spec.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/lib/gitlab/auth/o_auth/user_spec.rb b/spec/lib/gitlab/auth/o_auth/user_spec.rb index a9b15c411dc..1e3da4f7c2d 100644 --- a/spec/lib/gitlab/auth/o_auth/user_spec.rb +++ b/spec/lib/gitlab/auth/o_auth/user_spec.rb @@ -787,11 +787,25 @@ describe Gitlab::Auth::OAuth::User do end end - describe '#bypass_two_factor?' do - subject { oauth_user.bypass_two_factor? } + describe "#bypass_two_factor?" do + it "when with allow_bypass_two_factor disabled (Default)" do + stub_omniauth_config(allow_bypass_two_factor: false) + expect(oauth_user.bypass_two_factor?).to be_falsey + end + + it "when with allow_bypass_two_factor enabled" do + stub_omniauth_config(allow_bypass_two_factor: true) + expect(oauth_user.bypass_two_factor?).to be_truthy + end + + it "when provider in allow_bypass_two_factor array" do + stub_omniauth_config(allow_bypass_two_factor: [provider]) + expect(oauth_user.bypass_two_factor?).to be_truthy + end - it 'returns always false' do - is_expected.to be_falsey + it "when provider not in allow_bypass_two_factor array" do + stub_omniauth_config(allow_bypass_two_factor: ["foo"]) + expect(oauth_user.bypass_two_factor?).to be_falsey end end end |