Skip to content

Commit

Permalink
:two_factor_authenticatable should be inserted on top
Browse files Browse the repository at this point in the history
  • Loading branch information
inkstak committed May 21, 2023
1 parent 733d11f commit 61ca1a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/devise-two-factor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module Devise
end

Devise.add_module(:two_factor_authenticatable, :route => :session, :strategy => true,
:controller => :sessions, :model => true)
:controller => :sessions, :model => true, :insert_at => 0)

Devise.add_module(:two_factor_backupable, :route => :session, :strategy => true,
:controller => :sessions, :model => true)
4 changes: 4 additions & 0 deletions spec/devise/models/two_factor_authenticatable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def save(validate)
end

describe ::Devise::Models::TwoFactorAuthenticatable do
it 'should be inserted prior to other devise modules' do
expect(Devise::ALL.first).to eq(:two_factor_authenticatable)
end

context 'When included in a class' do
subject { TwoFactorAuthenticatableDouble.new }

Expand Down

0 comments on commit 61ca1a0

Please sign in to comment.