Sha256: 74bc7290e0267a352f7ccc88e7e3f51455aa4633acdc79a342085bad800a2bf7
Contents?: true
Size: 1.31 KB
Versions: 4
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Persistence' do subject (:user) { User.create(email: 'mb@geemail.com', password: 'iwantabigmac1') } it 'requests the the otp challenge every log in' do enable_otp_and_sign_in user otp_challenge_for user visit user_token_path expect(current_path).to eq(user_token_path) sign_out user sign_in_user user expect(current_path).to eq(user_credential_path) end it 'a user should be able to set their browser as trusted' do # log in 1fa enable_otp_and_sign_in user otp_challenge_for user visit user_token_path expect(current_path).to eq(user_token_path) click_link('Trust this browser') expect(page).to have_content 'This browser is trusted' sign_out user sign_in_user user expect(current_path).to eq(root_path) end it 'trusted status should expire' do User.otp_trust_persistence = 1 user.reload enable_otp_and_sign_in user otp_challenge_for user visit user_token_path expect(current_path).to eq(user_token_path) click_link('Trust this browser') expect(page).to have_content 'This browser is trusted' sign_out user sleep User.otp_trust_persistence.to_i sign_in_user user expect(current_path).to eq(user_credential_path) end end
Version data entries
4 entries across 4 versions & 1 rubygems