diff --git a/lib/better_html/railtie.rb b/lib/better_html/railtie.rb index 8e25172..ae61bda 100644 --- a/lib/better_html/railtie.rb +++ b/lib/better_html/railtie.rb @@ -6,10 +6,13 @@ module BetterHtml class Railtie < Rails::Railtie initializer "better_html.better_erb.initialization" do BetterHtml::BetterErb.prepend! + end + config.after_initialize do ActiveSupport.on_load(:action_view) do BetterHtml.config.annotate_rendered_view_with_filenames = ActionView::Base.annotate_rendered_view_with_filenames end end end end + diff --git a/test/better_html/railtie_test.rb b/test/better_html/railtie_test.rb new file mode 100644 index 0000000..06491f2 --- /dev/null +++ b/test/better_html/railtie_test.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# setup dummy app +ENV["RAILS_ENV"] ||= "test" +require_relative "../dummy/config/environment" +# load railtie +require "test_helper" + +module BetterHtml + class RailtieTest < ActiveSupport::TestCase + test "configuration is copied from ActionView" do + _ = ActionView::Base + assert BetterHtml.config.annotate_rendered_view_with_filenames + end + end +end