diff --git a/spec/dummy/spec/helpers/react_on_rails_helper_spec.rb b/spec/dummy/spec/helpers/react_on_rails_helper_spec.rb index 57c58cb2e..b313aeb61 100644 --- a/spec/dummy/spec/helpers/react_on_rails_helper_spec.rb +++ b/spec/dummy/spec/helpers/react_on_rails_helper_spec.rb @@ -7,6 +7,7 @@ class PlainReactOnRailsHelper include ReactOnRailsHelper + include ActionView::Helpers::TagHelper end # rubocop:disable Metrics/BlockLength @@ -345,5 +346,30 @@ class PlainReactOnRailsHelper expect { ob.send(:rails_context, server_side: false) }.not_to raise_error end end + + describe "#rails_context_if_not_already_rendered", :focus do + let(:helper) { PlainReactOnRailsHelper.new } + + before do + allow(helper).to receive(:rails_context).and_return({ some: "context" }) + end + + it "returns a script tag with rails context when not already rendered" do + result = helper.send(:rails_context_if_not_already_rendered) + expect(result).to include('