Reserve keyword arguments for new options in assert_template_result

This commit is contained in:
Dylan Thacker-Smith
2022-09-01 17:38:09 -04:00
parent 93c252fe5a
commit 0787660603
2 changed files with 4 additions and 10 deletions
+1 -1
View File
@@ -184,7 +184,7 @@ class IfElseTagTest < Minitest::Test
tests.each do |vals, expected| tests.each do |vals, expected|
a, b, c = vals a, b, c = vals
assigns = { 'a' => a, 'b' => b, 'c' => c } 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, message: assigns.to_s)
end end
end end
end end
+3 -9
View File
@@ -37,19 +37,13 @@ module Minitest
module Assertions module Assertions
include Liquid include Liquid
def assert_template_result(expected, template, assigns = {}, message = nil) def assert_template_result(expected, template, assigns = {}, message: nil)
assert_equal(expected, Template.parse(template, line_numbers: true).render!(assigns), message) assert_equal(expected, Template.parse(template, line_numbers: true).render!(assigns), message)
end end
def assert_template_result_matches(expected, template, assigns = {}, message = nil) def assert_match_syntax_error(match, template)
return assert_template_result(expected, template, assigns, message) unless expected.is_a?(Regexp)
assert_match(expected, Template.parse(template, line_numbers: true).render!(assigns), message)
end
def assert_match_syntax_error(match, template, assigns = {})
exception = assert_raises(Liquid::SyntaxError) do exception = assert_raises(Liquid::SyntaxError) do
Template.parse(template, line_numbers: true).render(assigns) Template.parse(template, line_numbers: true).render
end end
assert_match(match, exception.message) assert_match(match, exception.message)
end end