While I develop, I would like to see sinatra app exceptions when running tests, cosider example:
require 'sinatra/base'
class ExceptionWeb < Sinatra::Base
enable :raise_errors
enable :dump_errors
configure do
enable :dump_errors
end
get "/" do
raise "hell"
"ok"
end
def self.bad_method
raise "bad method"
end
end
require 'rack/test'
describe 'The Web interface' do
include Rack::Test::Methods
def app
ExceptionWeb
end
it "should error out" do
get "/"
#puts last_response.errors
#ExceptionWeb.bad_method
#last_response.should be_ok
end
end
Following rspec code shows no exceptions at all, if I uncomment last_response, then I see something is wrong, but I don’t see what was wrong.
But calling mad_method shows me exception.
And adding puts last_response.errors to every test doesn’t look proper.
I tried sinatra config options raise_errors and dump_errors but that doesn’t help me much.
Any ideas?
This is combination of options that must be used and then it works.