Skip to content

Commit

Permalink
Add deprecator to the application's deprecators
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebarrie committed Jun 8, 2023
1 parent 882dd70 commit 36e8d1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/devise/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class Engine < ::Rails::Engine
app.reload_routes! if Devise.reload_routes
end

initializer "devise.deprecator" do |app|
app.deprecators[:devise] = Devise.deprecator if app.respond_to?(:deprecators)
end

initializer "devise.url_helpers" do
Devise.include_helpers(Devise::Controllers)
end
Expand Down
6 changes: 6 additions & 0 deletions test/rails_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ class RailsTest < ActiveSupport::TestCase
assert_equal :load_config_initializers, initializer.after
assert_equal :build_middleware_stack, initializer.before
end

if Rails.gem_version > Gem::Version.new("7.1")
test 'deprecator is added to application deprecators' do
assert_not_nil Rails.application.deprecators[:devise]
end
end
end

0 comments on commit 36e8d1a

Please sign in to comment.