make time_for always raise an ArgumentError if something goes wrong

This commit is contained in:
Konstantin Haase 2011-04-11 13:13:01 +02:00
parent 0522f10fa8
commit 5a91dce044
2 changed files with 2 additions and 2 deletions

View File

@ -421,7 +421,7 @@ module Sinatra
Time.parse value.to_s
end
rescue ArgumentError => boom
raise boom.to_s
raise boom
rescue Exception
raise ArgumentError, "unable to convert #{value.inspect} to a Time object"
end

View File

@ -679,7 +679,7 @@ class HelpersTest < Test::Unit::TestCase
end
it 'fails when Time.parse raises an ArgumentError' do
assert_raise(RuntimeError) { get '/boom' }
assert_raise(ArgumentError) { get '/boom' }
end
end