Sha256: 6963e0d0e25d4e47825aaed6928c27dbd49a61bffe8c39289444ec88a44c5a04

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

Combustion::Application.attr_reader(:content_security_policy_nonce)

RSpec.describe IJSRails::ActionViewHelpers do
  subject(:view) { ActionController::Base.new.view_context }

  describe '#render_ijs' do
    let(:name) { 'demo/hello' }

    subject { view.render_ijs(name) }

    it 'returns an HTML <script> tag containing the script' do
      expect(subject).to have_tag(:script, text: /alert\("Hello, World!"\);/)
    end

    context 'when :type is provided' do
      let(:type) { 'application/type' }

      subject { view.render_ijs(name, type: type) }

      it 'sets the :type attribute on the <script> element' do
        expect(subject).to have_tag(:script, with: { type: type })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ijs-rails-0.2.0 spec/ijs-rails/action_view_helpers_spec.rb