Add basic login form tests
This commit is contained in:
parent
3211f8f59b
commit
febcf347ee
|
@ -5,8 +5,26 @@ describe User::SessionsController do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#create" do
|
||||||
|
let(:user) { FactoryBot.create(:user, password: '/bin/animals64') }
|
||||||
|
|
||||||
|
subject { post :create, params: { user: { login: user.email, password: user.password } } }
|
||||||
|
|
||||||
|
it "logs in users without 2FA enabled without any further input" do
|
||||||
|
expect(subject).to redirect_to :root
|
||||||
|
end
|
||||||
|
|
||||||
|
it "prompts users with 2FA enabled to enter a code" do
|
||||||
|
user.otp_module = :enabled
|
||||||
|
user.save
|
||||||
|
|
||||||
|
expect(subject).to redirect_to :user_two_factor_entry
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#two_factor_entry" do
|
describe "#two_factor_entry" do
|
||||||
subject { get :two_factor_entry }
|
subject { get :two_factor_entry }
|
||||||
|
|
||||||
it "redirects back to the home page if no sign in target is set" do
|
it "redirects back to the home page if no sign in target is set" do
|
||||||
expect(subject).to redirect_to :root
|
expect(subject).to redirect_to :root
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue