Sha256: e3a0c236876f52454199519ab451ede40ee44a0ecf9d1a027efd2ed80c3294f7

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper')) 

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

  attr_reader :f
  def setup
    @f = NewRelic::Agent::Instrumentation::MetricFrame.new
  end
  
  def test_request_parsing__none
    assert_nil f.uri
    assert_nil f.referer
  end
  def test_request_parsing__path
    request = stub(:path => '/path?hello=bob#none')
    f.request = request
    assert_equal "/path", f.uri
  end
  def test_request_parsing__fullpath
    request = stub(:fullpath => '/path?hello=bob#none')
    f.request = request
    assert_equal "/path", f.uri
  end
  def test_request_parsing__referer
    request = stub(:referer => 'https://www.yahoo.com:8080/path/hello?bob=none&foo=bar')
    f.request = request
    assert_nil f.uri
    assert_equal "https://www.yahoo.com:8080/path/hello", f.referer
  end

  def test_request_parsing__uri
    request = stub(:uri => 'http://creature.com/path?hello=bob#none', :referer => '/path/hello?bob=none&foo=bar')
    f.request = request
    assert_equal "/path", f.uri
    assert_equal "/path/hello", f.referer
  end
  
  def test_request_parsing__hostname_only
    request = stub(:uri => 'http://creature.com')
    f.request = request
    assert_equal "/", f.uri
    assert_nil f.referer
  end
  def test_request_parsing__slash
    request = stub(:uri => 'http://creature.com/')
    f.request = request
    assert_equal "/", f.uri
    assert_nil f.referer
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
newrelic_rpm-2.14.1.logging1 test/new_relic/agent/instrumentation/metric_frame_test.rb
newrelic_rpm-2.14.1 test/new_relic/agent/instrumentation/metric_frame_test.rb
newrelic_rpm-2.14.0 test/new_relic/agent/instrumentation/metric_frame_test.rb
newrelic_rpm-2.13.6.beta2 test/new_relic/agent/instrumentation/metric_frame_test.rb
newrelic_rpm-2.13.6.beta1 test/new_relic/agent/instrumentation/metric_frame_test.rb