Browse Source

disable 2FA on review apps

pull/993/head
Phil Lee 4 years ago
parent
commit
735f850140
  1. 1
      app/models/user.rb
  2. 13
      spec/models/user_spec.rb

1
app/models/user.rb

@ -125,6 +125,7 @@ class User < ApplicationRecord
def need_two_factor_authentication?(_request)
return false if Rails.env.development?
return false if Rails.env.review?
support?
end

13
spec/models/user_spec.rb

@ -159,6 +159,19 @@ RSpec.describe User, type: :model do
expect(user.need_two_factor_authentication?(nil)).to be false
end
end
context "when the user is in review environment" do
let(:user) { FactoryBot.create(:user, :support) }
before do
allow(Rails.env).to receive(:development?).and_return(false)
allow(Rails.env).to receive(:review?).and_return(true)
end
it "does not require 2FA" do
expect(user.need_two_factor_authentication?(nil)).to be false
end
end
end
describe "paper trail" do

Loading…
Cancel
Save