Improved clarity of sort nil input error message.

Signed-off-by: Martin Jorn Rogalla <martin@martinrogalla.com>
This commit is contained in:
Martin Jorn Rogalla 2015-03-01 09:51:59 +01:00
parent 0565308ce6
commit 78af3c5018
2 changed files with 2 additions and 2 deletions

View File

@ -223,7 +223,7 @@ module Jekyll
# Returns the filtered array of objects
def sort(input, property = nil, nils = "first")
if input.nil?
raise ArgumentError.new("Nil object array given. Sort cannot process an empty object array.")
raise ArgumentError.new("Sort: cannot sort a null object.")
end
if property.nil?
input.sort

View File

@ -284,7 +284,7 @@ class TestFilters < JekyllUnitTest
err = assert_raises ArgumentError do
@filter.sort(nil)
end
assert_equal "Nil object array given. Sort cannot process an empty object array.", err.message
assert_equal "Sort: cannot sort a null object.", err.message
end
should "return sorted numbers" do
assert_equal [1, 2, 2.2, 3], @filter.sort([3, 2.2, 2, 1])