Sha256: 6aef3a289efdc33a1b8d3d0fdd3181101e1d9fb9f04fed75b9d82ce10988eec1

Contents?: true

Size: 1.32 KB

Versions: 17

Compression:

Stored size: 1.32 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/transaction_sample/composite_segment'
class NewRelic::TransactionSample::CompositeSegmentTest < Test::Unit::TestCase
  def test_composite_segment_creation
    fake_segment = mock_segment
    NewRelic::TransactionSample::CompositeSegment.new([fake_segment])
  end

  def test_detail_segments_equals
    fake_segment = mock_segment
    cs = NewRelic::TransactionSample::CompositeSegment.new([fake_segment])

    # note that this is a bare mock
    # nothing should be called on it, for now
    other_fake_segment = mock('other segment')
    cs.detail_segments = [other_fake_segment]

    assert_equal cs.detail_segments, [other_fake_segment]
  end

  private

  @@seg_count = 0
  def mock_segment
    @@seg_count += 1
    segment = mock('segment ' + @@seg_count.to_s)
    segment.expects(:entry_timestamp).returns(Time.now)
    # note the following 'twice' - different than SummarySegment
    segment.expects(:exit_timestamp).returns(Time.now).twice
    segment.expects(:metric_name).returns('Custom/test/metric')
    segment.expects(:called_segments).returns([])
    segment
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.5.130 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.4.122 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.4.113.beta test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.3.111 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.3.106 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.3.105.beta test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.3.104 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.3.103.beta test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.2.96 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.2.90.beta test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.1.88 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.1.87 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.1.86.beta test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.1.85.beta test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.0.83 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.0.78 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.0.74.beta test/new_relic/transaction_sample/composite_segment_test.rb