Sha256: 8e3474a82134b69f8ed98b6a3553648f43741ec49ac717dcaf657daea2ff4e59

Contents?: true

Size: 954 Bytes

Versions: 9

Compression:

Stored size: 954 Bytes

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/sinatra'

class NewRelic::Agent::Instrumentation::SinatraTest < Test::Unit::TestCase
  class SinatraTestApp
    def initialize(response)
      @response = response
    end

    def dispatch!
      @response = response
    end

    include NewRelic::Agent::Instrumentation::Sinatra
    alias dispatch_without_newrelic dispatch!
    alias dispatch! dispatch_with_newrelic
  end

  def test_newrelic_request_headers
    app = SinatraTestApp.new([200, {}, ["OK"]])
    expected_headers = {:fake => :header}
    app.expects(:request).returns(mock('request', :env => expected_headers))
    assert_equal app.send(:newrelic_request_headers), expected_headers
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.2.96 test/new_relic/agent/instrumentation/sinatra_test.rb
newrelic_rpm-3.6.2.90.beta test/new_relic/agent/instrumentation/sinatra_test.rb
newrelic_rpm-3.6.1.88 test/new_relic/agent/instrumentation/sinatra_test.rb
newrelic_rpm-3.6.1.87 test/new_relic/agent/instrumentation/sinatra_test.rb
newrelic_rpm-3.6.1.86.beta test/new_relic/agent/instrumentation/sinatra_test.rb
newrelic_rpm-3.6.1.85.beta test/new_relic/agent/instrumentation/sinatra_test.rb
newrelic_rpm-3.6.0.83 test/new_relic/agent/instrumentation/sinatra_test.rb
newrelic_rpm-3.6.0.78 test/new_relic/agent/instrumentation/sinatra_test.rb
newrelic_rpm-3.6.0.74.beta test/new_relic/agent/instrumentation/sinatra_test.rb