Sha256: fa507ba359dd254930f356ef7a7972d963d8b80ccace85280b89759df894226e
Contents?: true
Size: 1.51 KB
Versions: 6
Compression:
Stored size: 1.51 KB
Contents
require "rails_helper" # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox) # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved. RSpec.describe "<%= plural_class_name %>::TfaAuthentication", type: :system do let!(:<%= singular_name %>) { create(:<%= singular_name %>) } before do <%= singular_name %>.create_otp_credential! end scenario "A <%= singular_name %> signs in successfully with otp" do sign_in(<%= singular_name %>, tfa: false) expect(current_path).to eql(new_<%= plural_name %>_tfa_session_path) fill_in(:tfa_session_otp, with: <%= singular_name %>.otp_credential.send(:current_otp)) click_button("Submit code") expect(current_path).to eql(<%= plural_name %>_dashboard_path) end scenario "A <%= singular_name %> attempts with the wrong otp" do sign_in(<%= singular_name %>, tfa: false) expect(current_path).to eql(new_<%= plural_name %>_tfa_session_path) fill_in(:tfa_session_otp, with: '999999') click_button("Submit code") expect(page).to have_text("not correct") end scenario "A <%= singular_name %> signs in successfully with a recovery code" do sign_in(<%= singular_name %>, tfa: false) expect(current_path).to eql(new_<%= plural_name %>_tfa_session_path) click_link("Use a recovery code") fill_in(:tfa_session_recovery_code, with: <%= singular_name %>.otp_credential.recovery_codes.sample) click_button("Submit code") expect(current_path).to eql(<%= plural_name %>_dashboard_path) end end
Version data entries
6 entries across 6 versions & 1 rubygems