1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
sinatra/test/mapped_error_test.rb
Ryan Tomayko 60d50062d7 Fix whitespace errors across all source files and tests
I can't stand this shit anymore.
2008-08-31 02:10:37 -07:00

61 lines
808 B
Ruby

require File.dirname(__FILE__) + '/helper'
class FooError < RuntimeError; end
context "Mapped errors" do
setup do
Sinatra.application = nil
end
specify "are rescued and run in context" do
error FooError do
'MAPPED ERROR!'
end
get '/' do
raise FooError.new
end
get_it '/'
should.be.server_error
body.should.equal 'MAPPED ERROR!'
end
specify "renders empty if no each method on result" do
error FooError do
nil
end
get '/' do
raise FooError.new
end
get_it '/'
should.be.server_error
body.should.be.empty
end
specify "doesn't override status if set" do
error FooError do
status(200)
end
get '/' do
raise FooError.new
end
get_it '/'
should.be.ok
end
end