Sha256: 464655f6bf0c87d014d4defaaa4da90c0ccb5017ec7eefdb91521ae0f34e669f

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 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.

require File.join(File.dirname(__FILE__), 'example_app')
require 'new_relic/rack/browser_monitoring'
require 'new_relic/rack/agent_hooks'
require 'new_relic/rack/error_collector'

if NewRelic::Agent::Instrumentation::RackHelpers.rack_version_supported?

  class RackCascadeTest < Minitest::Test
    include MultiverseHelpers

    setup_and_teardown_agent(
      :beacon                 => 'beacon',
      :browser_key            => 'browserKey',
      :js_agent_loader        => 'loader',
      :application_id         => '5',
      :'rum.enabled'          => true,
      :license_key            => 'a' * 40
    )

    include Rack::Test::Methods

    def app
      Rack::Builder.app do
        use NewRelic::Rack::AgentHooks
        use NewRelic::Rack::BrowserMonitoring
        use ResponseCodeMiddleware
        run Rack::Cascade.new([FirstCascadeExampleApp.new, SecondCascadeExampleApp.new])
      end
    end

    def test_insert_js_does_not_fire_for_rack_cascade_404_responses
      rsp = get '/', { 'body' => '<html><head></head><body></body></html>', 'override-response-code' => 404 }
      refute(rsp.body.include?('script'), "\nExpected\n---\n#{rsp.body}\n---\nnot to include 'script'.")
    end

    def test_rack_cascade_transactions_are_named_for_the_last_app
      rsp = get '/cascade'
      assert_metrics_recorded('Controller/SecondCascadeExampleApp/call')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
newrelic_rpm-3.14.0.305 test/multiverse/suites/rack/rack_cascade_test.rb
newrelic_rpm-3.13.2.302 test/multiverse/suites/rack/rack_cascade_test.rb
newrelic_rpm-3.13.1.300 test/multiverse/suites/rack/rack_cascade_test.rb
newrelic_rpm-3.13.0.299 test/multiverse/suites/rack/rack_cascade_test.rb
newrelic_rpm-3.12.1.298 test/multiverse/suites/rack/rack_cascade_test.rb
newrelic_rpm-3.12.0.288 test/multiverse/suites/rack/rack_cascade_test.rb
newrelic_rpm-3.11.2.286 test/multiverse/suites/rack/rack_cascade_test.rb
newrelic_rpm-3.11.1.284 test/multiverse/suites/rack/rack_cascade_test.rb
newrelic_rpm-3.11.0.283 test/multiverse/suites/rack/rack_cascade_test.rb