mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 17:30:43 -07:00
Stop passing assigns as keyword arguments to assert_template_result
This commit is contained in:
@@ -12,34 +12,34 @@ class VariableTest < Minitest::Test
|
||||
end
|
||||
|
||||
def test_variable_render_calls_to_liquid
|
||||
assert_template_result('foobar', '{{ foo }}', 'foo' => ThingWithToLiquid.new)
|
||||
assert_template_result('foobar', '{{ foo }}', { 'foo' => ThingWithToLiquid.new })
|
||||
end
|
||||
|
||||
def test_variable_lookup_calls_to_liquid_value
|
||||
assert_template_result('1', '{{ foo }}', 'foo' => IntegerDrop.new('1'))
|
||||
assert_template_result('2', '{{ list[foo] }}', 'foo' => IntegerDrop.new('1'), 'list' => [1, 2, 3])
|
||||
assert_template_result('one', '{{ list[foo] }}', 'foo' => IntegerDrop.new('1'), 'list' => { 1 => 'one' })
|
||||
assert_template_result('Yay', '{{ foo }}', 'foo' => BooleanDrop.new(true))
|
||||
assert_template_result('YAY', '{{ foo | upcase }}', 'foo' => BooleanDrop.new(true))
|
||||
assert_template_result('1', '{{ foo }}', { 'foo' => IntegerDrop.new('1') })
|
||||
assert_template_result('2', '{{ list[foo] }}', { 'foo' => IntegerDrop.new('1'), 'list' => [1, 2, 3] })
|
||||
assert_template_result('one', '{{ list[foo] }}', { 'foo' => IntegerDrop.new('1'), 'list' => { 1 => 'one' } })
|
||||
assert_template_result('Yay', '{{ foo }}', { 'foo' => BooleanDrop.new(true) })
|
||||
assert_template_result('YAY', '{{ foo | upcase }}', { 'foo' => BooleanDrop.new(true) })
|
||||
end
|
||||
|
||||
def test_if_tag_calls_to_liquid_value
|
||||
assert_template_result('one', '{% if foo == 1 %}one{% endif %}', 'foo' => IntegerDrop.new('1'))
|
||||
assert_template_result('one', '{% if 0 < foo %}one{% endif %}', 'foo' => IntegerDrop.new('1'))
|
||||
assert_template_result('one', '{% if foo > 0 %}one{% endif %}', 'foo' => IntegerDrop.new('1'))
|
||||
assert_template_result('true', '{% if foo == true %}true{% endif %}', 'foo' => BooleanDrop.new(true))
|
||||
assert_template_result('true', '{% if foo %}true{% endif %}', 'foo' => BooleanDrop.new(true))
|
||||
assert_template_result('one', '{% if foo == 1 %}one{% endif %}', { 'foo' => IntegerDrop.new('1') })
|
||||
assert_template_result('one', '{% if 0 < foo %}one{% endif %}', { 'foo' => IntegerDrop.new('1') })
|
||||
assert_template_result('one', '{% if foo > 0 %}one{% endif %}', { 'foo' => IntegerDrop.new('1') })
|
||||
assert_template_result('true', '{% if foo == true %}true{% endif %}', { 'foo' => BooleanDrop.new(true) })
|
||||
assert_template_result('true', '{% if foo %}true{% endif %}', { 'foo' => BooleanDrop.new(true) })
|
||||
|
||||
assert_template_result('', '{% if foo %}true{% endif %}', 'foo' => BooleanDrop.new(false))
|
||||
assert_template_result('', '{% if foo == true %}True{% endif %}', 'foo' => BooleanDrop.new(false))
|
||||
assert_template_result('', '{% if foo %}true{% endif %}', { 'foo' => BooleanDrop.new(false) })
|
||||
assert_template_result('', '{% if foo == true %}True{% endif %}', { 'foo' => BooleanDrop.new(false) })
|
||||
end
|
||||
|
||||
def test_unless_tag_calls_to_liquid_value
|
||||
assert_template_result('', '{% unless foo %}true{% endunless %}', 'foo' => BooleanDrop.new(true))
|
||||
assert_template_result('', '{% unless foo %}true{% endunless %}', { 'foo' => BooleanDrop.new(true) })
|
||||
end
|
||||
|
||||
def test_case_tag_calls_to_liquid_value
|
||||
assert_template_result('One', '{% case foo %}{% when 1 %}One{% endcase %}', 'foo' => IntegerDrop.new('1'))
|
||||
assert_template_result('One', '{% case foo %}{% when 1 %}One{% endcase %}', { 'foo' => IntegerDrop.new('1') })
|
||||
end
|
||||
|
||||
def test_simple_with_whitespaces
|
||||
@@ -49,8 +49,8 @@ class VariableTest < Minitest::Test
|
||||
end
|
||||
|
||||
def test_expression_with_whitespace_in_square_brackets
|
||||
assert_template_result('result', "{{ a[ 'b' ] }}", 'a' => { 'b' => 'result' })
|
||||
assert_template_result('result', "{{ a[ [ 'b' ] ] }}", 'b' => 'c', 'a' => { 'c' => 'result' })
|
||||
assert_template_result('result', "{{ a[ 'b' ] }}", { 'a' => { 'b' => 'result' } })
|
||||
assert_template_result('result', "{{ a[ [ 'b' ] ] }}", { 'b' => 'c', 'a' => { 'c' => 'result' } })
|
||||
end
|
||||
|
||||
def test_ignore_unknown
|
||||
@@ -69,8 +69,8 @@ class VariableTest < Minitest::Test
|
||||
end
|
||||
|
||||
def test_hash_scoping
|
||||
assert_template_result('worked', "{{ test.test }}", 'test' => { 'test' => 'worked' })
|
||||
assert_template_result('worked', "{{ test . test }}", 'test' => { 'test' => 'worked' })
|
||||
assert_template_result('worked', "{{ test.test }}", { 'test' => { 'test' => 'worked' } })
|
||||
assert_template_result('worked', "{{ test . test }}", { 'test' => { 'test' => 'worked' } })
|
||||
end
|
||||
|
||||
def test_false_renders_as_false
|
||||
@@ -125,14 +125,14 @@ class VariableTest < Minitest::Test
|
||||
end
|
||||
|
||||
def test_render_symbol
|
||||
assert_template_result('bar', '{{ foo }}', 'foo' => :bar)
|
||||
assert_template_result('bar', '{{ foo }}', { 'foo' => :bar })
|
||||
end
|
||||
|
||||
def test_dynamic_find_var
|
||||
assert_template_result('bar', '{{ [key] }}', 'key' => 'foo', 'foo' => 'bar')
|
||||
assert_template_result('bar', '{{ [key] }}', { 'key' => 'foo', 'foo' => 'bar' })
|
||||
end
|
||||
|
||||
def test_raw_value_variable
|
||||
assert_template_result('bar', '{{ [key] }}', 'key' => 'foo', 'foo' => 'bar')
|
||||
assert_template_result('bar', '{{ [key] }}', { 'key' => 'foo', 'foo' => 'bar' })
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user