have invoke raise ArgumentErrors instead of TypeErrors
This commit is contained in:
parent
8f1c7bca96
commit
b10b80c28e
|
@ -727,7 +727,7 @@ module Sinatra
|
|||
res = catch(:halt) { yield }
|
||||
res = [res] if Fixnum === res or String === res
|
||||
if Array === res and Fixnum === res.first
|
||||
raise TypeError, "#{res.inspect} not supported" if res.length > 3
|
||||
raise ArgumentError, "#{res.inspect} not supported" if res.length > 3
|
||||
status(res.shift)
|
||||
body(res.pop)
|
||||
headers(*res)
|
||||
|
|
|
@ -76,14 +76,14 @@ class ResultTest < Test::Unit::TestCase
|
|||
assert_equal 'formula of', body
|
||||
end
|
||||
|
||||
it "raises a TypeError when result is a non two or three tuple Array" do
|
||||
it "raises a ArgumentError when result is a non two or three tuple Array" do
|
||||
mock_app {
|
||||
get '/' do
|
||||
[409, 'formula of', 'something else', 'even more']
|
||||
end
|
||||
}
|
||||
|
||||
assert_raise(TypeError) { get '/' }
|
||||
assert_raise(ArgumentError) { get '/' }
|
||||
end
|
||||
|
||||
it "sets status when result is a Fixnum status code" do
|
||||
|
|
Loading…
Reference in New Issue