Appease the dog overlords
This commit is contained in:
parent
1a848af303
commit
887a053e71
|
@ -3,9 +3,11 @@
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe Settings::TwoFactorAuthentication::OtpAuthenticationController, type: :controller do
|
describe Settings::TwoFactorAuthentication::OtpAuthenticationController, type: :controller do
|
||||||
let(:user) { FactoryBot.create :user,
|
let(:user) do
|
||||||
|
FactoryBot.create :user,
|
||||||
otp_module: :disabled,
|
otp_module: :disabled,
|
||||||
otp_secret_key: "EJFNIJPYXXTCQSRTQY6AG7XQLAT2IDG5H7NGLJE3" }
|
otp_secret_key: "EJFNIJPYXXTCQSRTQY6AG7XQLAT2IDG5H7NGLJE3"
|
||||||
|
end
|
||||||
|
|
||||||
describe "#index" do
|
describe "#index" do
|
||||||
subject { get :index }
|
subject { get :index }
|
||||||
|
@ -45,7 +47,7 @@ describe Settings::TwoFactorAuthentication::OtpAuthenticationController, type: :
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows an error if the user enters the incorrect code" do
|
it "shows an error if the user enters the incorrect code" do
|
||||||
Timecop.freeze(Time.at(1603290888)) do
|
Timecop.freeze(Time.at(1603290888).utc) do
|
||||||
subject
|
subject
|
||||||
expect(response).to redirect_to :settings_two_factor_authentication_otp_authentication
|
expect(response).to redirect_to :settings_two_factor_authentication_otp_authentication
|
||||||
expect(flash[:error]).to eq("The code you entered was invalid.")
|
expect(flash[:error]).to eq("The code you entered was invalid.")
|
||||||
|
@ -61,7 +63,7 @@ describe Settings::TwoFactorAuthentication::OtpAuthenticationController, type: :
|
||||||
end
|
end
|
||||||
|
|
||||||
it "enables 2FA for the logged in user and generates recovery keys" do
|
it "enables 2FA for the logged in user and generates recovery keys" do
|
||||||
Timecop.freeze(Time.at(1603290888)) do
|
Timecop.freeze(Time.at(1603290888).utc) do
|
||||||
subject
|
subject
|
||||||
expect(response).to have_rendered(:recovery_keys)
|
expect(response).to have_rendered(:recovery_keys)
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ describe Settings::TwoFactorAuthentication::OtpAuthenticationController, type: :
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows an error if the user attempts to use the code once it has expired" do
|
it "shows an error if the user attempts to use the code once it has expired" do
|
||||||
Timecop.freeze(Time.at(1603290950)) do
|
Timecop.freeze(Time.at(1603290950).utc) do
|
||||||
subject
|
subject
|
||||||
expect(response).to redirect_to :settings_two_factor_authentication_otp_authentication
|
expect(response).to redirect_to :settings_two_factor_authentication_otp_authentication
|
||||||
expect(flash[:error]).to eq(I18n.t("errors.invalid_otp"))
|
expect(flash[:error]).to eq(I18n.t("errors.invalid_otp"))
|
||||||
|
|
Loading…
Reference in New Issue