mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Make sort filter work on Enumerable drops
This commit is contained in:
@@ -31,7 +31,7 @@ class TestEnumerable < Liquid::Drop
|
||||
include Enumerable
|
||||
|
||||
def each(&block)
|
||||
[ { "foo" => 1 }, { "foo" => 2 }, { "foo" => 3 } ].each(&block)
|
||||
[ { "foo" => 1, "bar" => 2 }, { "foo" => 2, "bar" => 1 }, { "foo" => 3, "bar" => 3 } ].each(&block)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -147,6 +147,10 @@ class StandardFiltersTest < Test::Unit::TestCase
|
||||
assert_equal "123", Liquid::Template.parse('{{ foo | map: "foo" }}').render!("foo" => TestEnumerable.new)
|
||||
end
|
||||
|
||||
def test_sort_works_on_enumerables
|
||||
assert_equal "213", Liquid::Template.parse('{{ foo | sort: "bar" | map: "foo" }}').render!("foo" => TestEnumerable.new)
|
||||
end
|
||||
|
||||
def test_date
|
||||
assert_equal 'May', @filters.date(Time.parse("2006-05-05 10:00:00"), "%B")
|
||||
assert_equal 'June', @filters.date(Time.parse("2006-06-05 10:00:00"), "%B")
|
||||
|
||||
Reference in New Issue
Block a user