mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-28 22:55:12 -07:00
Fix broken standardfilter test
This commit is contained in:
@@ -98,7 +98,7 @@ module Liquid
|
|||||||
# Sort elements of the array
|
# Sort elements of the array
|
||||||
# provide optional property with which to sort an array of hashes or drops
|
# provide optional property with which to sort an array of hashes or drops
|
||||||
def sort(input, property = nil)
|
def sort(input, property = nil)
|
||||||
ary = InputIterator.new(input).to_a
|
ary = InputIterator.new(input)
|
||||||
if property.nil?
|
if property.nil?
|
||||||
ary.sort
|
ary.sort
|
||||||
elsif ary.first.respond_to?('[]'.freeze) and !ary.first[property].nil?
|
elsif ary.first.respond_to?('[]'.freeze) and !ary.first[property].nil?
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ class Filters
|
|||||||
end
|
end
|
||||||
|
|
||||||
class TestThing
|
class TestThing
|
||||||
|
attr_reader :foo
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@foo = 0
|
@foo = 0
|
||||||
end
|
end
|
||||||
@@ -149,7 +151,8 @@ class StandardFiltersTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_sort_calls_to_liquid
|
def test_sort_calls_to_liquid
|
||||||
t = TestThing.new
|
t = TestThing.new
|
||||||
assert_template_result "woot: 1", '{{ foo | sort: "whatever" }}', "foo" => [t]
|
Liquid::Template.parse('{{ foo | sort: "whatever" }}').render("foo" => [t])
|
||||||
|
assert t.foo > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_map_over_proc
|
def test_map_over_proc
|
||||||
|
|||||||
Reference in New Issue
Block a user