|
|
@ -52,4 +52,19 @@ describe Devise::Models::TwoFactorAuthenticatable, '#authenticate_otp' do |
|
|
|
code = instance.otp_code(1.minutes.ago.to_i) |
|
|
|
code = instance.otp_code(1.minutes.ago.to_i) |
|
|
|
expect(do_invoke(code)).to eq(false) |
|
|
|
expect(do_invoke(code)).to eq(false) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe Devise::Models::TwoFactorAuthenticatable, '#send_two_factor_authentication_code' do |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "should raise an error by default" do |
|
|
|
|
|
|
|
instance = AuthenticatedModelHelper.create_new_user |
|
|
|
|
|
|
|
expect { |
|
|
|
|
|
|
|
instance.send_two_factor_authentication_code |
|
|
|
|
|
|
|
}.to raise_error(NotImplementedError) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "should be overrideable" do |
|
|
|
|
|
|
|
instance = AuthenticatedModelHelper.create_new_user_with_overrides |
|
|
|
|
|
|
|
expect(instance.send_two_factor_authentication_code).to eq("Code sent") |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |