Sha256: a5945935f1797e60e819d4beae96a2dd886f719d87554f29db2c532f7edd6ec1

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 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/summary_segment'
class NewRelic::TransactionSample::SummarySegmentTest < MiniTest::Unit::TestCase
  def test_summary_segment_creation
    fake_segment = mock_segment
    NewRelic::TransactionSample::SummarySegment.new(fake_segment)
  end

  def test_add_segments
    fake_segment = mock_segment
    ss = NewRelic::TransactionSample::SummarySegment.new(fake_segment)
    other_fake_segment = mock_segment
    # with the new summary segment
    ss.expects(:add_called_segment).with(instance_of(NewRelic::TransactionSample::SummarySegment))
    ss.add_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)
    segment.expects(:exit_timestamp).returns(Time.now)
    segment.expects(:metric_name).returns('Custom/test/metric')
    segment.expects(:called_segments).returns([])
    segment
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-3.7.2.195 test/new_relic/transaction_sample/summary_segment_test.rb
newrelic_rpm-3.7.2.192 test/new_relic/transaction_sample/summary_segment_test.rb
newrelic_rpm-3.7.2.190.beta test/new_relic/transaction_sample/summary_segment_test.rb