Skip to content

Commit 906bb27

Browse files
committed
update spec
1 parent 4c3ed73 commit 906bb27

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/liquid-rails/tags/content_for_tag.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
#
55
# Usage:
66
#
7-
# {% content_for :not_authorized %}
7+
# {% content_for not_authorized %}
88
# alert('You are not authorized to do that!');
99
# {% endcontent_for %}
1010
#
1111
# You can then use content_for :not_authorized anywhere in your templates.
1212
# {% if current_user.nil? %}
13-
# {% yield :not_authorized %}
13+
# {% yield not_authorized %}
1414
# {% endif %}
1515

1616
module Liquid
1717
module Rails
1818
class ContentForTag < ::Liquid::Block
19-
Syntax = /(#{::Liquid::QuotedFragment})\s*(flush\s*(true|false))?/
19+
Syntax = /(#{::Liquid::QuotedFragment}+)\s*(flush\s*(true|false))?/
2020

2121
def initialize(tag_name, markup, context)
2222
super
@@ -43,7 +43,7 @@ def render(context)
4343
module Liquid
4444
module Rails
4545
class YieldTag < ::Liquid::Tag
46-
Syntax = /(#{::Liquid::QuotedFragment})/
46+
Syntax = /(#{::Liquid::QuotedFragment}+)/
4747

4848
def initialize(tag_name, markup, context)
4949
super

spec/lib/liquid-rails/tags/content_for_tag_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ module Liquid
44
module Rails
55
describe ContentForTag, type: :tag do
66
it 'content_for and yield' do
7-
Liquid::Template.parse(%|{% content_for not_authorized1 %}alert('You are not authorized to do that!');{% endcontent_for %}|).render(context)
7+
Liquid::Template.parse(%|{% content_for 'not_authorized1' %}alert('You are not authorized to do that!');{% endcontent_for %}|).render(context)
88

9-
expect_template_result(%|{% yield not_authorized1 %}|, "alert('You are not authorized to do that!');")
9+
expect_template_result(%|{% yield 'not_authorized1' %}|, "alert('You are not authorized to do that!');")
1010
end
1111

1212
it 'invokes content_for with the same identifier multiple times' do
13-
Liquid::Template.parse(%|{% content_for not_authorized2 %}alert('You are not authorized to do that 1!');{% endcontent_for %}|).render(context)
14-
Liquid::Template.parse(%|{% content_for not_authorized2 %}alert('You are not authorized to do that 2!');{% endcontent_for %}|).render(context)
13+
Liquid::Template.parse(%|{% content_for 'not_authorized2' %}alert('You are not authorized to do that 1!');{% endcontent_for %}|).render(context)
14+
Liquid::Template.parse(%|{% content_for 'not_authorized2' %}alert('You are not authorized to do that 2!');{% endcontent_for %}|).render(context)
1515

16-
expect_template_result(%|{% yield not_authorized2 %}|, "alert('You are not authorized to do that 1!');alert('You are not authorized to do that 2!');")
16+
expect_template_result(%|{% yield 'not_authorized2' %}|, "alert('You are not authorized to do that 1!');alert('You are not authorized to do that 2!');")
1717
end
1818

1919
it 'invokes content_for with the same identifier multiple times and flush' do
20-
Liquid::Template.parse(%|{% content_for not_authorized3 %}alert('You are not authorized to do that 1!');{% endcontent_for %}|).render(context)
21-
Liquid::Template.parse(%|{% content_for not_authorized3 flush true %}alert('You are not authorized to do that 2!');{% endcontent_for %}|).render(context)
20+
Liquid::Template.parse(%|{% content_for 'not_authorized3' %}alert('You are not authorized to do that 1!');{% endcontent_for %}|).render(context)
21+
Liquid::Template.parse(%|{% content_for 'not_authorized3' flush true %}alert('You are not authorized to do that 2!');{% endcontent_for %}|).render(context)
2222

23-
expect_template_result(%|{% yield not_authorized3 %}|, "alert('You are not authorized to do that 2!');")
23+
expect_template_result(%|{% yield 'not_authorized3' %}|, "alert('You are not authorized to do that 2!');")
2424
end
2525
end
2626
end

0 commit comments

Comments
 (0)