mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 19:00:39 -07:00
Merge pull request #309 from bogdan/argument_error_for_filters
Raise liquid argument error instead of ruby argument
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
* Fix clashing method names in enumerable drops, see #238 [Florian Weingarten, fw42]
|
* Fix clashing method names in enumerable drops, see #238 [Florian Weingarten, fw42]
|
||||||
* Make map filter work on enumerable drops, see #233 [Florian Weingarten, fw42]
|
* Make map filter work on enumerable drops, see #233 [Florian Weingarten, fw42]
|
||||||
* Improved whitespace stripping for blank blocks, related to #216 [Florian Weingarten, fw42]
|
* Improved whitespace stripping for blank blocks, related to #216 [Florian Weingarten, fw42]
|
||||||
|
* Raise `Liquid::ArgumentError` instead of `::ArgumentError` when filter has wrong number of arguments #309 [Bogdan Gusiev, bogdan]
|
||||||
|
|
||||||
## 2.6.0 / 2013-11-25 / branch "2.6-stable"
|
## 2.6.0 / 2013-11-25 / branch "2.6-stable"
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ module Liquid
|
|||||||
else
|
else
|
||||||
args.first
|
args.first
|
||||||
end
|
end
|
||||||
|
rescue ::ArgumentError => e
|
||||||
|
raise Liquid::ArgumentError.new(e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def invokable?(method)
|
def invokable?(method)
|
||||||
|
|||||||
@@ -22,6 +22,13 @@ class StrainerTest < Test::Unit::TestCase
|
|||||||
assert_equal "public", strainer.invoke("public_filter")
|
assert_equal "public", strainer.invoke("public_filter")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_stainer_raises_argument_error
|
||||||
|
strainer = Strainer.create(nil)
|
||||||
|
assert_raises(Liquid::ArgumentError) do
|
||||||
|
strainer.invoke("public_filter", 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_strainer_only_invokes_public_filter_methods
|
def test_strainer_only_invokes_public_filter_methods
|
||||||
strainer = Strainer.create(nil)
|
strainer = Strainer.create(nil)
|
||||||
assert_equal false, strainer.invokable?('__test__')
|
assert_equal false, strainer.invokable?('__test__')
|
||||||
|
|||||||
Reference in New Issue
Block a user