No variant should also be picked up by variant.any if variant.none is not...

No variant should also be picked up by variant.any if variant.none is not defined (just like any other variant)
上级 f9e4c3c7
......@@ -532,7 +532,7 @@ def method_missing(name, *args, &block)
def variant
if @variant.nil?
@variants[:none]
@variants[:none] || @variants[:any]
elsif (@variants.keys & @variant).any?
@variant.each do |v|
return @variants[v] if @variants.key?(v)
......
......@@ -671,6 +671,10 @@ def test_variant_any
end
def test_variant_any_any
get :variant_any_any
assert_equal "text/html", @response.content_type
assert_equal "any", @response.body
@request.variant = :phone
get :variant_any_any
assert_equal "text/html", @response.content_type
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册