Sha256: 70bae22401fdca258edd6cf1650439b68c321ee67570a0389c6a09b043a7c832
Contents?: true
Size: 1.2 KB
Versions: 14
Compression:
Stored size: 1.2 KB
Contents
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details. class SinatraErrorTracingTestApp < Sinatra::Base configure do set :show_exceptions, false end get '/will_boom' do raise 'Boom!' end error do 'We are sorry' end end class SinatraErrorTracingTest < Test::Unit::TestCase include Rack::Test::Methods include ::NewRelic::Agent::Instrumentation::Sinatra def app SinatraErrorTracingTestApp end def setup ::NewRelic::Agent.manual_start @error_collector = ::NewRelic::Agent.instance.error_collector @error_collector.errors.clear assert(@error_collector.enabled?, 'error collector should be enabled') end def test_traps_errors get '/will_boom' assert_equal 500, last_response.status assert_equal 'We are sorry', last_response.body assert_equal(1, @error_collector.errors.size) end def test_ignores_notfound_errors_by_default get '/ignored_boom' assert_equal 404, last_response.status assert_match %r{Sinatra doesn’t know this ditty\.}, last_response.body assert_equal(0, @error_collector.errors.size) end end
Version data entries
14 entries across 14 versions & 1 rubygems