Sha256: f769978d5e00d5bd08a0e754d146ce4d246460584467fa2f74b6fe2cc68b7538

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 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 < Minitest::Test
  include Rack::Test::Methods
  include ::NewRelic::Agent::Instrumentation::Sinatra

  include MultiverseHelpers

  setup_and_teardown_agent

  def app
    SinatraErrorTracingTestApp
  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, agent.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&rsquo;t know this ditty\.}, last_response.body
    assert_equal(0, agent.error_collector.errors.size)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
newrelic_rpm-3.13.2.302 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.13.1.300 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.13.0.299 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.12.1.298 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.12.0.288 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.11.2.286 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.11.1.284 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.11.0.283 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb