Sha256: b85f706dad5007611b75c13c4a14ad6366445aa19b976c322de072b123488d2d

Contents?: true

Size: 1.41 KB

Versions: 20

Compression:

Stored size: 1.41 KB

Contents

require 'minitest_helper'
require 'rack/test'
require 'rack/lobster'
require 'oboe/inst/rack'

class RackTestApp < Minitest::Test
  include Rack::Test::Methods

  def app
    @app = Rack::Builder.new {
      use Rack::CommonLogger
      use Rack::ShowExceptions
      use Oboe::Rack
      map "/lobster" do
        use Rack::Lint
        run Rack::Lobster.new
      end
    }
  end

  def test_custom_do_not_trace
    clear_all_traces

    dnt_original = Oboe::Config[:dnt_regexp]
    Oboe::Config[:dnt_regexp] = "lobster$"

    get "/lobster"

    traces = get_all_traces
    assert traces.empty?

    Oboe::Config[:dnt_regexp] = dnt_original
  end

  def test_do_not_trace_static_assets
    clear_all_traces

    get "/assets/static_asset.png"

    traces = get_all_traces
    assert traces.empty?

    assert last_response.status == 404
  end

  def test_complex_do_not_trace
    skip "not supported" if RUBY_VERSION < '1.9'

    clear_all_traces

    dnt_original = Oboe::Config[:dnt_regexp]

    # Do not trace .js files _except for_ show.js
    Oboe::Config[:dnt_regexp] = "(\.js$)(?<!show.js)"

    # First: We shouldn't trace general .js files
    get "/javascripts/application.js"

    traces = get_all_traces
    assert traces.empty?

    # Second: We should trace show.js
    clear_all_traces

    get "/javascripts/show.js"

    traces = get_all_traces
    assert !traces.empty?

    Oboe::Config[:dnt_regexp] = dnt_original
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
oboe-2.7.19-java test/support/dnt_test.rb
oboe-2.7.19 test/support/dnt_test.rb
oboe-2.7.18-java test/support/dnt_test.rb
oboe-2.7.18 test/support/dnt_test.rb
oboe-2.7.17.1-java test/support/dnt_test.rb
oboe-2.7.17.1 test/support/dnt_test.rb
oboe-2.7.16.1 test/support/dnt_test.rb
oboe-2.7.16.1-java test/support/dnt_test.rb
oboe-2.7.15.1-java test/support/dnt_test.rb
oboe-2.7.15.1 test/support/dnt_test.rb
oboe-2.7.14.1-java test/support/dnt_test.rb
oboe-2.7.14.1 test/support/dnt_test.rb
oboe-2.7.13.3-java test/support/dnt_test.rb
oboe-2.7.13.3 test/support/dnt_test.rb
oboe-2.7.12.1-java test/support/dnt_test.rb
oboe-2.7.12.1 test/support/dnt_test.rb
oboe-2.7.11.1 test/support/dnt_test.rb
oboe-2.7.11.1-java test/support/dnt_test.rb
oboe-2.7.10.1-java test/support/dnt_test.rb
oboe-2.7.10.1 test/support/dnt_test.rb