mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
rubocop autocorrect Style/MethodCallWithArgsParentheses
This commit is contained in:
@@ -44,7 +44,7 @@ class AssignTest < Minitest::Test
|
||||
end
|
||||
end
|
||||
with_error_mode(:lax) do
|
||||
assert Template.parse("{% assign foo = ('X' | downcase) %}")
|
||||
assert(Template.parse("{% assign foo = ('X' | downcase) %}"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class BlockTest < Minitest::Test
|
||||
|
||||
def test_with_custom_tag
|
||||
with_custom_tag('testtag', Block) do
|
||||
assert Liquid::Template.parse("{% testtag %} {% endtesttag %}")
|
||||
assert(Liquid::Template.parse("{% testtag %} {% endtesttag %}"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,13 +28,13 @@ class BlockTest < Minitest::Test
|
||||
with_custom_tag('blabla', klass1) do
|
||||
template = Liquid::Template.parse("{% blabla %} bla {% endblabla %}")
|
||||
|
||||
assert_equal 'hello', template.render
|
||||
assert_equal('hello', template.render)
|
||||
|
||||
buf = +''
|
||||
output = template.render({}, output: buf)
|
||||
assert_equal 'hello', output
|
||||
assert_equal 'hello', buf
|
||||
assert_equal buf.object_id, output.object_id
|
||||
assert_equal('hello', output)
|
||||
assert_equal('hello', buf)
|
||||
assert_equal(buf.object_id, output.object_id)
|
||||
end
|
||||
|
||||
klass2 = Class.new(klass1) do
|
||||
@@ -46,13 +46,13 @@ class BlockTest < Minitest::Test
|
||||
with_custom_tag('blabla', klass2) do
|
||||
template = Liquid::Template.parse("{% blabla %} foo {% endblabla %}")
|
||||
|
||||
assert_equal 'foohellobar', template.render
|
||||
assert_equal('foohellobar', template.render)
|
||||
|
||||
buf = +''
|
||||
output = template.render({}, output: buf)
|
||||
assert_equal 'foohellobar', output
|
||||
assert_equal 'foohellobar', buf
|
||||
assert_equal buf.object_id, output.object_id
|
||||
assert_equal('foohellobar', output)
|
||||
assert_equal('foohellobar', buf)
|
||||
assert_equal(buf.object_id, output.object_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -566,9 +566,9 @@ class ContextTest < Minitest::Test
|
||||
def test_disables_tag_specified
|
||||
context = Context.new
|
||||
context.with_disabled_tags(%w(foo bar)) do
|
||||
assert_equal true, context.tag_disabled?("foo")
|
||||
assert_equal true, context.tag_disabled?("bar")
|
||||
assert_equal false, context.tag_disabled?("unknown")
|
||||
assert_equal(true, context.tag_disabled?("foo"))
|
||||
assert_equal(true, context.tag_disabled?("bar"))
|
||||
assert_equal(false, context.tag_disabled?("unknown"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -576,19 +576,19 @@ class ContextTest < Minitest::Test
|
||||
context = Context.new
|
||||
context.with_disabled_tags(["foo"]) do
|
||||
context.with_disabled_tags(["foo"]) do
|
||||
assert_equal true, context.tag_disabled?("foo")
|
||||
assert_equal false, context.tag_disabled?("bar")
|
||||
assert_equal(true, context.tag_disabled?("foo"))
|
||||
assert_equal(false, context.tag_disabled?("bar"))
|
||||
end
|
||||
context.with_disabled_tags(["bar"]) do
|
||||
assert_equal true, context.tag_disabled?("foo")
|
||||
assert_equal true, context.tag_disabled?("bar")
|
||||
assert_equal(true, context.tag_disabled?("foo"))
|
||||
assert_equal(true, context.tag_disabled?("bar"))
|
||||
context.with_disabled_tags(["foo"]) do
|
||||
assert_equal true, context.tag_disabled?("foo")
|
||||
assert_equal true, context.tag_disabled?("bar")
|
||||
assert_equal(true, context.tag_disabled?("foo"))
|
||||
assert_equal(true, context.tag_disabled?("bar"))
|
||||
end
|
||||
end
|
||||
assert_equal true, context.tag_disabled?("foo")
|
||||
assert_equal false, context.tag_disabled?("bar")
|
||||
assert_equal(true, context.tag_disabled?("foo"))
|
||||
assert_equal(false, context.tag_disabled?("bar"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -606,16 +606,16 @@ class ContextTest < Minitest::Test
|
||||
end
|
||||
|
||||
with_global_filter(global) do
|
||||
assert_equal 'Global test', Template.parse("{{'test' | notice }}").render!
|
||||
assert_equal 'Local test', Template.parse("{{'test' | notice }}").render!({}, filters: [local])
|
||||
assert_equal('Global test', Template.parse("{{'test' | notice }}").render!)
|
||||
assert_equal('Local test', Template.parse("{{'test' | notice }}").render!({}, filters: [local]))
|
||||
end
|
||||
end
|
||||
|
||||
def test_has_key_will_not_add_an_error_for_missing_keys
|
||||
with_error_mode :strict do
|
||||
with_error_mode(:strict) do
|
||||
context = Context.new
|
||||
context.key?('unknown')
|
||||
assert_empty context.errors
|
||||
assert_empty(context.errors)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ class DropsTest < Minitest::Test
|
||||
def test_object_methods_not_allowed
|
||||
[:dup, :clone, :singleton_class, :eval, :class_eval, :inspect].each do |method|
|
||||
output = Liquid::Template.parse(" {{ product.#{method} }} ").render!('product' => ProductDrop.new)
|
||||
assert_equal ' ', output
|
||||
assert_equal(' ', output)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -210,28 +210,28 @@ class DropsTest < Minitest::Test
|
||||
|
||||
def test_enumerable_drop_will_invoke_liquid_method_missing_for_clashing_method_names
|
||||
["select", "each", "map", "cycle"].each do |method|
|
||||
assert_equal method.to_s, Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => EnumerableDrop.new)
|
||||
assert_equal method.to_s, Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => EnumerableDrop.new)
|
||||
assert_equal method.to_s, Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => RealEnumerableDrop.new)
|
||||
assert_equal method.to_s, Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => RealEnumerableDrop.new)
|
||||
assert_equal(method.to_s, Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => EnumerableDrop.new))
|
||||
assert_equal(method.to_s, Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => EnumerableDrop.new))
|
||||
assert_equal(method.to_s, Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => RealEnumerableDrop.new))
|
||||
assert_equal(method.to_s, Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => RealEnumerableDrop.new))
|
||||
end
|
||||
end
|
||||
|
||||
def test_some_enumerable_methods_still_get_invoked
|
||||
[:count, :max].each do |method|
|
||||
assert_equal "3", Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => RealEnumerableDrop.new)
|
||||
assert_equal "3", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => RealEnumerableDrop.new)
|
||||
assert_equal "3", Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => EnumerableDrop.new)
|
||||
assert_equal "3", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => EnumerableDrop.new)
|
||||
assert_equal("3", Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => RealEnumerableDrop.new))
|
||||
assert_equal("3", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => RealEnumerableDrop.new))
|
||||
assert_equal("3", Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => EnumerableDrop.new))
|
||||
assert_equal("3", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => EnumerableDrop.new))
|
||||
end
|
||||
|
||||
assert_equal("yes", Liquid::Template.parse("{% if collection contains 3 %}yes{% endif %}").render!('collection' => RealEnumerableDrop.new))
|
||||
|
||||
[:min, :first].each do |method|
|
||||
assert_equal "1", Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => RealEnumerableDrop.new)
|
||||
assert_equal "1", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => RealEnumerableDrop.new)
|
||||
assert_equal "1", Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => EnumerableDrop.new)
|
||||
assert_equal "1", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => EnumerableDrop.new)
|
||||
assert_equal("1", Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => RealEnumerableDrop.new))
|
||||
assert_equal("1", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => RealEnumerableDrop.new))
|
||||
assert_equal("1", Liquid::Template.parse("{{collection.#{method}}}").render!('collection' => EnumerableDrop.new))
|
||||
assert_equal("1", Liquid::Template.parse("{{collection[\"#{method}\"]}}").render!('collection' => EnumerableDrop.new))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ class ErrorHandlingTest < Minitest::Test
|
||||
|
||||
# Liquid should not catch Exceptions that are not subclasses of StandardError, like Interrupt and NoMemoryError
|
||||
def test_exceptions_propagate
|
||||
assert_raises Exception do
|
||||
assert_raises(Exception) do
|
||||
template = Liquid::Template.parse('{{ errors.exception }}')
|
||||
template.render('errors' => ErrorDrop.new)
|
||||
end
|
||||
|
||||
@@ -169,9 +169,9 @@ class FiltersInTemplate < Minitest::Test
|
||||
|
||||
def test_local_global
|
||||
with_global_filter(MoneyFilter) do
|
||||
assert_equal " 1000$ ", Template.parse("{{1000 | money}}").render!(nil, nil)
|
||||
assert_equal " 1000$ CAD ", Template.parse("{{1000 | money}}").render!(nil, filters: CanadianMoneyFilter)
|
||||
assert_equal " 1000$ CAD ", Template.parse("{{1000 | money}}").render!(nil, filters: [CanadianMoneyFilter])
|
||||
assert_equal(" 1000$ ", Template.parse("{{1000 | money}}").render!(nil, nil))
|
||||
assert_equal(" 1000$ CAD ", Template.parse("{{1000 | money}}").render!(nil, filters: CanadianMoneyFilter))
|
||||
assert_equal(" 1000$ CAD ", Template.parse("{{1000 | money}}").render!(nil, filters: [CanadianMoneyFilter]))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class HashOrderingTest < Minitest::Test
|
||||
|
||||
def test_global_register_order
|
||||
with_global_filter(MoneyFilter, CanadianMoneyFilter) do
|
||||
assert_equal " 1000$ CAD ", Template.parse("{{1000 | money}}").render(nil, nil)
|
||||
assert_equal(" 1000$ CAD ", Template.parse("{{1000 | money}}").render(nil, nil))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ class ParsingQuirksTest < Minitest::Test
|
||||
assert(Template.parse("{{test}}"))
|
||||
|
||||
with_error_mode(:lax) do
|
||||
assert Template.parse("{{|test}}")
|
||||
assert(Template.parse("{{|test}}"))
|
||||
end
|
||||
|
||||
with_error_mode(:strict) do
|
||||
|
||||
@@ -133,7 +133,7 @@ class ProfilerTest < Minitest::Test
|
||||
|
||||
include_node = t.profiler[1]
|
||||
include_node.children.each do |child|
|
||||
assert_equal "a_template", child.partial
|
||||
assert_equal("a_template", child.partial)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -143,12 +143,12 @@ class ProfilerTest < Minitest::Test
|
||||
|
||||
a_template = t.profiler[1]
|
||||
a_template.children.each do |child|
|
||||
assert_equal "a_template", child.partial
|
||||
assert_equal("a_template", child.partial)
|
||||
end
|
||||
|
||||
b_template = t.profiler[2]
|
||||
b_template.children.each do |child|
|
||||
assert_equal "b_template", child.partial
|
||||
assert_equal("b_template", child.partial)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -158,12 +158,12 @@ class ProfilerTest < Minitest::Test
|
||||
|
||||
a_template1 = t.profiler[1]
|
||||
a_template1.children.each do |child|
|
||||
assert_equal "a_template", child.partial
|
||||
assert_equal("a_template", child.partial)
|
||||
end
|
||||
|
||||
a_template2 = t.profiler[2]
|
||||
a_template2.children.each do |child|
|
||||
assert_equal "a_template", child.partial
|
||||
assert_equal("a_template", child.partial)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
assert_equal('1', @filters.url_decode(1))
|
||||
assert_equal('2001-02-03', @filters.url_decode(Date.new(2001, 2, 3)))
|
||||
assert_nil(@filters.url_decode(nil))
|
||||
exception = assert_raises Liquid::ArgumentError do
|
||||
exception = assert_raises(Liquid::ArgumentError) do
|
||||
@filters.url_decode('%ff')
|
||||
end
|
||||
assert_equal('Liquid error: invalid byte sequence in UTF-8', exception.message)
|
||||
@@ -286,7 +286,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
[3],
|
||||
]
|
||||
|
||||
assert_raises Liquid::ArgumentError do
|
||||
assert_raises(Liquid::ArgumentError) do
|
||||
@filters.sort(foo, "bar")
|
||||
end
|
||||
end
|
||||
@@ -302,7 +302,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
[3],
|
||||
]
|
||||
|
||||
assert_raises Liquid::ArgumentError do
|
||||
assert_raises(Liquid::ArgumentError) do
|
||||
@filters.sort_natural(foo, "bar")
|
||||
end
|
||||
end
|
||||
@@ -337,7 +337,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
[3],
|
||||
]
|
||||
|
||||
assert_raises Liquid::ArgumentError do
|
||||
assert_raises(Liquid::ArgumentError) do
|
||||
@filters.uniq(foo, "bar")
|
||||
end
|
||||
end
|
||||
@@ -353,7 +353,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
[3],
|
||||
]
|
||||
|
||||
assert_raises Liquid::ArgumentError do
|
||||
assert_raises(Liquid::ArgumentError) do
|
||||
@filters.compact(foo, "bar")
|
||||
end
|
||||
end
|
||||
@@ -430,7 +430,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
[3],
|
||||
]
|
||||
|
||||
assert_raises Liquid::ArgumentError do
|
||||
assert_raises(Liquid::ArgumentError) do
|
||||
@filters.map(foo, "bar")
|
||||
end
|
||||
end
|
||||
@@ -441,7 +441,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
[2],
|
||||
[3],
|
||||
]
|
||||
assert_raises Liquid::ArgumentError do
|
||||
assert_raises(Liquid::ArgumentError) do
|
||||
@filters.map(foo, nil)
|
||||
end
|
||||
end
|
||||
@@ -485,8 +485,8 @@ class StandardFiltersTest < Minitest::Test
|
||||
assert_equal('', @filters.date('', "%B"))
|
||||
|
||||
with_timezone("UTC") do
|
||||
assert_equal "07/05/2006", @filters.date(1152098955, "%m/%d/%Y")
|
||||
assert_equal "07/05/2006", @filters.date("1152098955", "%m/%d/%Y")
|
||||
assert_equal("07/05/2006", @filters.date(1152098955, "%m/%d/%Y"))
|
||||
assert_equal("07/05/2006", @filters.date("1152098955", "%m/%d/%Y"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -587,7 +587,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
|
||||
assert_template_result("0.5", "{{ 2.0 | divided_by:4 }}")
|
||||
assert_raises(Liquid::ZeroDivisionError) do
|
||||
assert_template_result "4", "{{ 1 | modulo: 0 }}"
|
||||
assert_template_result("4", "{{ 1 | modulo: 0 }}")
|
||||
end
|
||||
|
||||
assert_template_result("5", "{{ price | divided_by:2 }}", 'price' => NumberLikeThing.new(10))
|
||||
@@ -596,7 +596,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
def test_modulo
|
||||
assert_template_result("1", "{{ 3 | modulo:2 }}")
|
||||
assert_raises(Liquid::ZeroDivisionError) do
|
||||
assert_template_result "4", "{{ 1 | modulo: 0 }}"
|
||||
assert_template_result("4", "{{ 1 | modulo: 0 }}")
|
||||
end
|
||||
|
||||
assert_template_result("1", "{{ price | modulo:2 }}", 'price' => NumberLikeThing.new(3))
|
||||
@@ -607,7 +607,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
assert_template_result("4", "{{ '4.3' | round }}")
|
||||
assert_template_result("4.56", "{{ input | round: 2 }}", 'input' => 4.5612)
|
||||
assert_raises(Liquid::FloatDomainError) do
|
||||
assert_template_result "4", "{{ 1.0 | divided_by: 0.0 | round }}"
|
||||
assert_template_result("4", "{{ 1.0 | divided_by: 0.0 | round }}")
|
||||
end
|
||||
|
||||
assert_template_result("5", "{{ price | round }}", 'price' => NumberLikeThing.new(4.6))
|
||||
@@ -618,7 +618,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
assert_template_result("5", "{{ input | ceil }}", 'input' => 4.6)
|
||||
assert_template_result("5", "{{ '4.3' | ceil }}")
|
||||
assert_raises(Liquid::FloatDomainError) do
|
||||
assert_template_result "4", "{{ 1.0 | divided_by: 0.0 | ceil }}"
|
||||
assert_template_result("4", "{{ 1.0 | divided_by: 0.0 | ceil }}")
|
||||
end
|
||||
|
||||
assert_template_result("5", "{{ price | ceil }}", 'price' => NumberLikeThing.new(4.6))
|
||||
@@ -628,7 +628,7 @@ class StandardFiltersTest < Minitest::Test
|
||||
assert_template_result("4", "{{ input | floor }}", 'input' => 4.6)
|
||||
assert_template_result("4", "{{ '4.3' | floor }}")
|
||||
assert_raises(Liquid::FloatDomainError) do
|
||||
assert_template_result "4", "{{ 1.0 | divided_by: 0.0 | floor }}"
|
||||
assert_template_result("4", "{{ 1.0 | divided_by: 0.0 | floor }}")
|
||||
end
|
||||
|
||||
assert_template_result("5", "{{ price | floor }}", 'price' => NumberLikeThing.new(5.4))
|
||||
|
||||
@@ -15,13 +15,13 @@ class TagTest < Minitest::Test
|
||||
with_custom_tag('blabla', klass1) do
|
||||
template = Liquid::Template.parse("{% blabla %}")
|
||||
|
||||
assert_equal 'hello', template.render
|
||||
assert_equal('hello', template.render)
|
||||
|
||||
buf = +''
|
||||
output = template.render({}, output: buf)
|
||||
assert_equal 'hello', output
|
||||
assert_equal 'hello', buf
|
||||
assert_equal buf.object_id, output.object_id
|
||||
assert_equal('hello', output)
|
||||
assert_equal('hello', buf)
|
||||
assert_equal(buf.object_id, output.object_id)
|
||||
end
|
||||
|
||||
klass2 = Class.new(klass1) do
|
||||
@@ -33,13 +33,13 @@ class TagTest < Minitest::Test
|
||||
with_custom_tag('blabla', klass2) do
|
||||
template = Liquid::Template.parse("{% blabla %}")
|
||||
|
||||
assert_equal 'foohellobar', template.render
|
||||
assert_equal('foohellobar', template.render)
|
||||
|
||||
buf = +''
|
||||
output = template.render({}, output: buf)
|
||||
assert_equal 'foohellobar', output
|
||||
assert_equal 'foohellobar', buf
|
||||
assert_equal buf.object_id, output.object_id
|
||||
assert_equal('foohellobar', output)
|
||||
assert_equal('foohellobar', buf)
|
||||
assert_equal(buf.object_id, output.object_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -184,7 +184,7 @@ class IfElseTagTest < Minitest::Test
|
||||
tests.each do |vals, expected|
|
||||
a, b, c = vals
|
||||
assigns = { 'a' => a, 'b' => b, 'c' => c }
|
||||
assert_template_result expected.to_s, tpl, assigns, assigns.to_s
|
||||
assert_template_result(expected.to_s, tpl, assigns, assigns.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -226,13 +226,13 @@ class IncludeTagTest < Minitest::Test
|
||||
Template.parse("{% include template %}", error_mode: :strict).render!("template" => '{{ "X" || downcase }}')
|
||||
end
|
||||
with_error_mode(:lax) do
|
||||
assert_equal 'x', Template.parse("{% include template %}", error_mode: :strict, include_options_blacklist: true).render!("template" => '{{ "X" || downcase }}')
|
||||
assert_equal('x', Template.parse("{% include template %}", error_mode: :strict, include_options_blacklist: true).render!("template" => '{{ "X" || downcase }}'))
|
||||
end
|
||||
assert_raises(Liquid::SyntaxError) do
|
||||
Template.parse("{% include template %}", error_mode: :strict, include_options_blacklist: [:locale]).render!("template" => '{{ "X" || downcase }}')
|
||||
end
|
||||
with_error_mode(:lax) do
|
||||
assert_equal 'x', Template.parse("{% include template %}", error_mode: :strict, include_options_blacklist: [:error_mode]).render!("template" => '{{ "X" || downcase }}')
|
||||
assert_equal('x', Template.parse("{% include template %}", error_mode: :strict, include_options_blacklist: [:error_mode]).render!("template" => '{{ "X" || downcase }}'))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class RenderTagTest < Minitest::Test
|
||||
def test_recursively_rendered_template_does_not_produce_endless_loop
|
||||
Liquid::Template.file_system = StubFileSystem.new('loop' => '{% render "loop" %}')
|
||||
|
||||
assert_raises Liquid::StackLevelError do
|
||||
assert_raises(Liquid::StackLevelError) do
|
||||
Template.parse('{% render "loop" %}').render!
|
||||
end
|
||||
end
|
||||
@@ -67,7 +67,7 @@ class RenderTagTest < Minitest::Test
|
||||
Liquid::Template.file_system = StubFileSystem.new(
|
||||
'loop_render' => '{% render "loop_render" %}',
|
||||
)
|
||||
assert_raises Liquid::StackLevelError do
|
||||
assert_raises(Liquid::StackLevelError) do
|
||||
Template.parse('{% render "loop_render" %}').render!
|
||||
end
|
||||
end
|
||||
@@ -75,7 +75,7 @@ class RenderTagTest < Minitest::Test
|
||||
def test_dynamically_choosen_templates_are_not_allowed
|
||||
Liquid::Template.file_system = StubFileSystem.new('snippet' => 'should not be rendered')
|
||||
|
||||
assert_raises Liquid::SyntaxError do
|
||||
assert_raises(Liquid::SyntaxError) do
|
||||
Liquid::Template.parse("{% assign name = 'snippet' %}{% render name %}")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -198,7 +198,7 @@ class TemplateTest < Minitest::Test
|
||||
context = Context.new('drop' => ErroneousDrop.new)
|
||||
t = Template.new.parse('{{ drop.bad_method }}')
|
||||
|
||||
e = assert_raises RuntimeError do
|
||||
e = assert_raises(RuntimeError) do
|
||||
t.render!(context)
|
||||
end
|
||||
assert_equal('ruby error in drop', e.message)
|
||||
@@ -267,7 +267,7 @@ class TemplateTest < Minitest::Test
|
||||
def test_undefined_variables_raise
|
||||
t = Template.parse("{{x}} {{y}} {{z.a}} {{z.b}} {{z.c.d}}")
|
||||
|
||||
assert_raises UndefinedVariable do
|
||||
assert_raises(UndefinedVariable) do
|
||||
t.render!({ 'x' => 33, 'z' => { 'a' => 32, 'c' => { 'e' => 31 } } }, strict_variables: true)
|
||||
end
|
||||
end
|
||||
@@ -286,7 +286,7 @@ class TemplateTest < Minitest::Test
|
||||
d = DropWithUndefinedMethod.new
|
||||
t = Template.new.parse('{{ foo }} {{ woot }}')
|
||||
|
||||
assert_raises UndefinedDropMethod do
|
||||
assert_raises(UndefinedDropMethod) do
|
||||
t.render!(d, strict_variables: true)
|
||||
end
|
||||
end
|
||||
@@ -309,7 +309,7 @@ class TemplateTest < Minitest::Test
|
||||
def test_undefined_filters_raise
|
||||
t = Template.parse("{{x | somefilter1 | upcase | somefilter2}}")
|
||||
|
||||
assert_raises UndefinedFilter do
|
||||
assert_raises(UndefinedFilter) do
|
||||
t.render!({ 'x' => 'foo' }, strict_filters: true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ class I18nUnitTest < Minitest::Test
|
||||
# end
|
||||
|
||||
def test_raises_unknown_translation
|
||||
assert_raises I18n::TranslationError do
|
||||
assert_raises(I18n::TranslationError) do
|
||||
@i18n.translate("doesnt_exist")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -108,7 +108,7 @@ class VariableUnitTest < Minitest::Test
|
||||
assert_equal(VariableLookup.new('foo-bar'), create_variable('foo-bar').name)
|
||||
assert_equal(VariableLookup.new('foo-bar-2'), create_variable('foo-bar-2').name)
|
||||
|
||||
with_error_mode :strict do
|
||||
with_error_mode(:strict) do
|
||||
assert_raises(Liquid::SyntaxError) { create_variable('foo - bar') }
|
||||
assert_raises(Liquid::SyntaxError) { create_variable('-foo') }
|
||||
assert_raises(Liquid::SyntaxError) { create_variable('2foo') }
|
||||
|
||||
Reference in New Issue
Block a user