have invoke raise ArgumentErrors instead of TypeErrors

This commit is contained in:
Konstantin Haase 2011-06-04 18:24:42 +02:00
parent 8f1c7bca96
commit b10b80c28e
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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