Skip to content

Commit

Permalink
Support actionview 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebarrie committed Mar 19, 2024
1 parent ea19da1 commit bcc021f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gemfiles/Gemfile-rails-6-0
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source "https://rubygems.org"
gemspec path: ".."

gem "actionview", "~> 6.0.0"
gem "rake"
gem "railties"
gem "rake-compiler"
gem "minitest"
gem "mocha"
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile-rails-6-1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source "https://rubygems.org"
gemspec path: ".."

gem "actionview", "~> 6.1.0"
gem "rake"
gem "railties"
gem "rake-compiler"
gem "minitest"
gem "mocha"
Expand Down
2 changes: 2 additions & 0 deletions lib/better_html/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Railtie < Rails::Railtie

config.after_initialize do
ActiveSupport.on_load(:action_view) do
next unless ActionView::Base.respond_to?(:annotate_rendered_view_with_filenames)

BetterHtml.config.annotate_rendered_view_with_filenames = ActionView::Base.annotate_rendered_view_with_filenames
end
end
Expand Down
8 changes: 5 additions & 3 deletions test/better_html/railtie_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

module BetterHtml
class RailtieTest < ActiveSupport::TestCase
test "configuration is copied from ActionView" do
_ = ActionView::Base
assert BetterHtml.config.annotate_rendered_view_with_filenames
if Rails::VERSION::STRING >= "6.1"
test "configuration is copied from ActionView" do
_ = ActionView::Base
assert BetterHtml.config.annotate_rendered_view_with_filenames
end
end
end
end
4 changes: 3 additions & 1 deletion test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Application < Rails::Application
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de

config.action_view.annotate_rendered_view_with_filenames = true
if Rails::VERSION::STRING >= "6.1"
config.action_view.annotate_rendered_view_with_filenames = true
end
end
end

0 comments on commit bcc021f

Please sign in to comment.