Stringify properties before filtering (#1929)

This commit is contained in:
Ian Ker-Seymer
2025-03-17 17:43:57 -04:00
committed by GitHub
parent c5711c095f
commit f5d6a36574
2 changed files with 16 additions and 1 deletions
+13
View File
@@ -1061,6 +1061,19 @@ class StandardFiltersTest < Minitest::Test
assert_template_result(expected_output, template, { "array" => array })
end
def test_where_with_non_string_property
array = [
{ "handle" => "alpha", "{}" => true },
{ "handle" => "beta", "{}" => false },
{ "handle" => "gamma", "{}" => false },
{ "handle" => "delta", "{}" => true },
]
template = "{{ array | where: some_property, true | map: 'handle' | join: ' ' }}"
expected_output = "alpha delta"
assert_template_result(expected_output, template, { "array" => array, "some_property" => {} })
end
def test_where_string_keys
input = [
"alpha", "beta", "gamma", "delta"