Sha256: bba3874b7caae1f04a43f4aa2becbbe08f8e417b8d26d71224bae62aa6f43867
Contents?: true
Size: 810 Bytes
Versions: 26
Compression:
Stored size: 810 Bytes
Contents
require 'spec_helper' describe Locomotive::Liquid::Tags::Csrf do it 'renders the param tag for form' do html = render_tag html.should == '<input type="hidden" name="token" value="42">' end it 'renders the meta tag used by ajax requests' do html = render_tag('csrf_meta') html.should include '<meta name="csrf-param" content="token">' html.should include '<meta name="csrf-token" content="42">' end def render_tag(tag_name = 'csrf_param') controller = mock('controller', { request_forgery_protection_token: 'token', form_authenticity_token: '42' }) registers = { controller: controller } liquid_context = ::Liquid::Context.new({}, {}, registers) Liquid::Template.parse("{% #{tag_name} %}").render(liquid_context) end end
Version data entries
26 entries across 26 versions & 1 rubygems