Sha256: 73bcefba4b5f5fa5a9f42366475268b8ff21e16084da9e1aa277c9e17843805c

Contents?: true

Size: 1012 Bytes

Versions: 12

Compression:

Stored size: 1012 Bytes

Contents

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

class NewRelic::Agent::NoticedErrorTest < Test::Unit::TestCase
  def setup
    @path = 'foo/bar/baz'
    @params = { 'key' => 'val' }
    @time = Time.now
  end

  def test_to_collector_array
    e = Exception.new('test exception')
    error = NewRelic::NoticedError.new(@path, @params, e, @time)
    expected = [
      (@time.to_f * 1000).round, @path, 'test exception', 'Exception', @params
    ]
    assert_equal expected, error.to_collector_array
  end

  def test_to_collector_array_with_bad_values
    error = NewRelic::NoticedError.new(@path, @params, nil, Rational(10, 1))
    expected = [
      10_000.0, @path, "<no message>", "Error", @params
    ]
    assert_equal expected, error.to_collector_array
  end

  def test_handles_non_string_exception_messages
    e = Exception.new({ :non => :string })
    error = NewRelic::NoticedError.new(@path, @params, e, @time)
    assert_equal(String, error.message.class)
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
wd_newrelic_rpm-3.5.8 test/new_relic/noticed_error_test.rb
sundawg_newrelic_rpm-3.5.8.2 test/new_relic/noticed_error_test.rb
sundawg_newrelic_rpm-3.5.8.1 test/new_relic/noticed_error_test.rb
newrelic_rpm-3.5.8.72 test/new_relic/noticed_error_test.rb
newrelic_rpm-3.5.8.70 test/new_relic/noticed_error_test.rb
newrelic_rpm-3.5.8.64.beta test/new_relic/noticed_error_test.rb
newrelic_rpm-3.5.7.59 test/new_relic/noticed_error_test.rb
newrelic_rpm-3.5.7.59.beta test/new_relic/noticed_error_test.rb
newrelic_rpm-3.5.7.58.beta test/new_relic/noticed_error_test.rb
wd_newrelic_rpm-3.5.6 test/new_relic/noticed_error_test.rb
newrelic_rpm-3.5.7.57.beta test/new_relic/noticed_error_test.rb
newrelic_rpm-3.5.6.55 test/new_relic/noticed_error_test.rb