Sha256: 7afa6a31b9ebfad230fabb5ec691e99a53de0923c90cd2fecc010f6924415fb0

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

module TestContexts
  def with_running_agent
    
    context 'with running agent' do # this is needed for the nested setups
      
      setup do
        @log_data = StringIO.new
        @log = Logger.new(@log_data)
        NewRelic::Agent.manual_start :log => @log 
        @agent = NewRelic::Agent.instance
        @agent.transaction_sampler.send :clear_builder
        @agent.transaction_sampler.reset!
        @agent.stats_engine.clear_stats
      end
      
      yield
      
      def teardown
        super
        NewRelic::Agent.shutdown
        @log_data.reset
        NewRelic::Control.instance['dispatcher']=nil
        NewRelic::Control.instance['dispatcher_instance_id']=nil
      end
      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_rpm-2.14.1.logging1 test/test_contexts.rb
newrelic_rpm-2.14.1 test/test_contexts.rb