Sha256: 97cfd87ed20834222b7f70258dfdc12f2f9a9649813143593d9a247cedd66313
Contents?: true
Size: 974 Bytes
Versions: 6
Compression:
Stored size: 974 Bytes
Contents
require 'spec_helper' describe Devise::TwoFactorAuthenticationController, type: :controller do describe 'is_fully_authenticated? helper' do def post_code(code) if Rails::VERSION::MAJOR >= 5 post :update, params: { code: code } else post :update, code: code end end before do sign_in end context 'after user enters valid OTP code' do it 'returns true' do controller.current_user.send_new_otp post_code controller.current_user.direct_otp expect(subject.is_fully_authenticated?).to eq true end end context 'when user has not entered any OTP yet' do it 'returns false' do get :show expect(subject.is_fully_authenticated?).to eq false end end context 'when user enters an invalid OTP' do it 'returns false' do post_code '12345' expect(subject.is_fully_authenticated?).to eq false end end end end
Version data entries
6 entries across 6 versions & 3 rubygems