Sha256: a6c99c9ea01ec29cb9ecb30d24b0e36e0958c0a25802713603f3c14711c1c309

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require "rails_helper"

module Archangel
  module Liquid
    module Tags
      RSpec.describe CsrfMetaTagsTag, type: :liquid_tag,
                                      disable: :verify_partial_doubles do
        let(:context) { ::Liquid::Context.new({}, {}, view: view) }

        it "returns CSRF meta tags" do
          allow(view).to receive(:protect_against_forgery?).and_return(true)
          allow(view).to(
            receive(:form_authenticity_token)
              .and_return("rails_form_authenticity_token")
          )

          result = ::Liquid::Template.parse("{% csrf_meta_tags %}")
                                     .render(context)

          expected_param =
            '<meta name="csrf-param" content="authenticity_token" />'
          expected_token =
            '<meta name="csrf-token" content="rails_form_authenticity_token" />'

          expect(result).to include(expected_param)
          expect(result).to include(expected_token)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
archangel-0.3.0 spec/lib/archangel/liquid/tags/csrf_meta_tags_tag_spec.rb
archangel-0.0.8 spec/lib/archangel/liquid/tags/csrf_meta_tags_tag_spec.rb
archangel-0.0.7 spec/lib/archangel/liquid/tags/csrf_meta_tags_tag_spec.rb
archangel-0.0.6 spec/lib/archangel/liquid/tags/csrf_meta_tags_tag_spec.rb
archangel-0.0.5 spec/lib/archangel/liquid/tags/csrf_meta_tags_tag_spec.rb
archangel-0.0.4 spec/lib/archangel/liquid/tags/csrf_meta_tags_tag_spec.rb
archangel-0.0.3 spec/lib/archangel/liquid/tags/csrf_meta_tags_tag_spec.rb
archangel-0.0.2 spec/lib/archangel/liquid/tags/csrf_meta_tags_tag_spec.rb