Browse Source

Fix reset_otp_state specs

The `user` variable was not defined in some specs.

I also removed the error message for the `ArgumentError` spec because
it's different depending on the Ruby version.
master
Moncef Belyamani 9 years ago
parent
commit
3d18eddf8a
  1. 4
      spec/features/two_factor_authenticatable_spec.rb
  2. 2
      spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb

4
spec/features/two_factor_authenticatable_spec.rb

@ -148,6 +148,8 @@ feature "User of two factor authentication" do
end end
describe 'signing in' do describe 'signing in' do
let(:user) { create_user }
scenario 'when UserOtpSender#reset_otp_state is defined' do scenario 'when UserOtpSender#reset_otp_state is defined' do
stub_const 'UserOtpSender', Class.new stub_const 'UserOtpSender', Class.new
@ -174,6 +176,8 @@ feature "User of two factor authentication" do
end end
describe 'signing out' do describe 'signing out' do
let(:user) { create_user }
scenario 'when UserOtpSender#reset_otp_state is defined' do scenario 'when UserOtpSender#reset_otp_state is defined' do
visit new_user_session_path visit new_user_session_path
complete_sign_in_form_for(user) complete_sign_in_form_for(user)

2
spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb

@ -224,7 +224,7 @@ describe Devise::Models::TwoFactorAuthenticatable do
# This error is raised by the encryptor gem # This error is raised by the encryptor gem
expect { instance.otp_secret_key = '2z6hxkdwi3uvrnpn' }. expect { instance.otp_secret_key = '2z6hxkdwi3uvrnpn' }.
to raise_error ArgumentError, 'must specify a :key' to raise_error ArgumentError
end end
it 'passes in the correct options to Encryptor' do it 'passes in the correct options to Encryptor' do

Loading…
Cancel
Save