Sha256: b9ac2dae1c3bd2afbffc84790708d49890410a94f46dbf84c0ff801d021e4e73

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 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

    errors = harvest_error_traces!
    assert_equal(1, 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

    errors = harvest_error_traces!
    assert_equal(0, errors.size)
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
newrelic_rpm-3.17.1.326 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.17.0.325 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.16.3.323 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.16.2.321 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.16.1.320 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.16.0.318 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.15.2.317 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.15.1.316 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.15.0.314 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.14.3.313 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.14.2.312 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.14.1.311 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb
newrelic_rpm-3.14.0.305 test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb