Sha256: 002505426fc3842055edc583f71ae45d14ea37a86b624c9a78c39326e6be965b

Contents?: true

Size: 1.33 KB

Versions: 26

Compression:

Stored size: 1.33 KB

Contents

# ENV['SKIP_RAILS'] = 'true'
require File.expand_path(File.join(File.dirname(__FILE__),'..', '..',
                                   'test_helper'))
require 'rack/test'
require 'new_relic/rack/developer_mode'

ENV['RACK_ENV'] = 'test'

class DeveloperModeTest < Test::Unit::TestCase
  include Rack::Test::Methods
  include TransactionSampleTestHelper

  def app
    mock_app = lambda { |env| [500, {}, "Don't touch me!"] }
    NewRelic::Rack::DeveloperMode.new(mock_app)
  end
  
  def setup
    @sampler = NewRelic::Agent::TransactionSampler.new
    run_sample_trace_on(@sampler, '/here')
    run_sample_trace_on(@sampler, '/there')
    run_sample_trace_on(@sampler, '/somewhere')
    NewRelic::Agent.instance.stubs(:transaction_sampler).returns(@sampler)
  end
  
  def test_index_displays_all_samples
    get '/newrelic'
    
    assert last_response.ok?
    assert last_response.body.include?('/here')
    assert last_response.body.include?('/there')
    assert last_response.body.include?('/somewhere')    
  end

  def test_show_sample_summary_displays_sample_details
    get "/newrelic/show_sample_summary?id=#{@sampler.samples[0].sample_id}"
    
    assert last_response.ok?
    assert last_response.body.include?('/here')
    assert last_response.body.include?('SandwichesController')
    assert last_response.body.include?('index')    
  end  
end

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
dolores_rpm-3.2.0.6 test/new_relic/rack/developer_mode_test.rb
dolores_rpm-3.2.0.5 test/new_relic/rack/developer_mode_test.rb
dolores_rpm-3.2.0.4 test/new_relic/rack/developer_mode_test.rb
dolores_rpm-3.2.0.3 test/new_relic/rack/developer_mode_test.rb
dolores_rpm-3.2.0.2 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.3.1 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.3.1.beta2 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.3.1.beta1 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.3.0 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.3.0.beta1 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.2.0.1 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.2.0 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.2.0.beta2 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.2.0.beta1 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.1.2 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.1.2.beta2 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.1.2.beta1 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.1.1 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.1.1.beta3 test/new_relic/rack/developer_mode_test.rb
newrelic_rpm-3.1.1.beta2 test/new_relic/rack/developer_mode_test.rb