Fix broken standardfilter test

This commit is contained in:
Florian Weingarten
2014-07-23 17:15:39 -04:00
committed by Arthur Neves
parent 02d42a1475
commit 994f309465
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ module Liquid
# Sort elements of the array
# provide optional property with which to sort an array of hashes or drops
def sort(input, property = nil)
ary = InputIterator.new(input).to_a
ary = InputIterator.new(input)
if property.nil?
ary.sort
elsif ary.first.respond_to?('[]'.freeze) and !ary.first[property].nil?
+4 -1
View File
@@ -7,6 +7,8 @@ class Filters
end
class TestThing
attr_reader :foo
def initialize
@foo = 0
end
@@ -149,7 +151,8 @@ class StandardFiltersTest < Test::Unit::TestCase
def test_sort_calls_to_liquid
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
def test_map_over_proc