Sha256: d8083c5d081f7008d716872f9113cba2750a20771552c20924011a280171d660

Contents?: true

Size: 1.07 KB

Versions: 14

Compression:

Stored size: 1.07 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.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper'))
require 'new_relic/agent/instrumentation/rack'

class MinimalRackApp
  def initialize(return_value)
    @return_value = return_value
  end

  def call(env)
    @return_value
  end

  include NewRelic::Agent::Instrumentation::Rack
end

class NewRelic::Agent::Instrumentation::RackTest < Test::Unit::TestCase

  def test_basic_rack_app
    # should return what we send in, even when instrumented
    x = MinimalRackApp.new([200, {}, ["whee"]])
    assert_equal [200, {}, ["whee"]], x.call({})
  end

  def test_basic_rack_app_404
    x = MinimalRackApp.new([404, {}, ["whee"]])
    assert_equal [404, {}, ["whee"]], x.call({})
  end

  def test_basic_rack_app_ignores_404
    NewRelic::Agent::Transaction.expects(:abort_transaction!)
    x = MinimalRackApp.new([404, {}, ["whee"]])
    assert_equal [404, {}, ["whee"]], x.call({})
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.5.130 test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.4.122 test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.4.113.beta test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.3.111 test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.3.106 test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.3.105.beta test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.3.104 test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.3.103.beta test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.2.96 test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.2.90.beta test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.1.88 test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.1.87 test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.1.86.beta test/new_relic/agent/instrumentation/rack_test.rb
newrelic_rpm-3.6.1.85.beta test/new_relic/agent/instrumentation/rack_test.rb