From f5f8548eb8f36b279838c77cc890b1ccf2eb3692 Mon Sep 17 00:00:00 2001 From: timwis Date: Thu, 25 Feb 2016 10:24:47 -0500 Subject: [PATCH] add tests for where arrays --- test/test_filters.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_filters.rb b/test/test_filters.rb index e9035b96..6eaff8f4 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -306,6 +306,16 @@ class TestFilters < JekyllUnitTest assert_equal 2, @filter.where(@array_of_objects, "color", "red").length end + should "filter array properties appropriately" do + hash = {"a"=>{"tags"=>["x","y"]}, "b"=>{"tags"=>["x"]}, "c"=>{"tags"=>["y","z"]}} + assert_equal 2, @filter.where(hash, "tags", "x").length + end + + should "filter array properties alongside string properties" do + hash = {"a"=>{"tags"=>["x","y"]}, "b"=>{"tags"=>"x"}, "c"=>{"tags"=>["y","z"]}} + assert_equal 2, @filter.where(hash, "tags", "x").length + end + should "stringify during comparison for compatibility with liquid parsing" do hash = { "The Words" => {"rating" => 1.2, "featured" => false},