Sha256: 6cbe880be350bed680ef37927e896f521155d3c9f298971aaab3a5ff5510e6be

Contents?: true

Size: 785 Bytes

Versions: 12

Compression:

Stored size: 785 Bytes

Contents

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

    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
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
wd_newrelic_rpm-3.5.8 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
sundawg_newrelic_rpm-3.5.8.2 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
sundawg_newrelic_rpm-3.5.8.1 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.5.8.72 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.5.8.70 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.5.8.64.beta test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.5.7.59 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.5.7.59.beta test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.5.7.58.beta test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
wd_newrelic_rpm-3.5.6 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.5.7.57.beta test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.5.6.55 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb