Sha256: 4c4295c315aa4aba2ca2bafb6eb0c22abdd5019c789c28744ad3d9deda1ef03b

Contents?: true

Size: 1.32 KB

Versions: 12

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

12 entries across 12 versions & 1 rubygems

Version Path
newrelic_rpm-3.7.1.188 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.7.1.182 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.7.1.180 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.7.0.177 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.7.0.174.beta test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.9.171 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.8.168 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.8.164 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.7.159 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.7.159.beta test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.7.152 test/new_relic/transaction_sample/composite_segment_test.rb
newrelic_rpm-3.6.6.147 test/new_relic/transaction_sample/composite_segment_test.rb