Sha256: e896ee4c60d8b4e3dd7b536683423510cd015b0385eddb8887c9c0684ad9da9f

Contents?: true

Size: 989 Bytes

Versions: 42

Compression:

Stored size: 989 Bytes

Contents

describe Appsignal::Rack::InstrumentationMiddleware do
  let(:app) { DummyApp.new }
  let(:env) { Rack::MockRequest.env_for("/some/path") }
  let(:middleware) { described_class.new(app, {}) }

  before { start_agent }
  around { |example| keep_transactions { example.run } }

  def make_request(env)
    middleware.call(env)
  end

  context "without an exception" do
    it "reports a process_request_middleware.rack event" do
      make_request(env)

      expect(last_transaction).to include_event("name" => "process_request_middleware.rack")
    end
  end

  context "with custom action name" do
    let(:app) { DummyApp.new { |_env| Appsignal.set_action("MyAction") } }

    it "reports the custom action name" do
      make_request(env)

      expect(last_transaction).to have_action("MyAction")
    end
  end

  context "without action name metadata" do
    it "reports no action name" do
      make_request(env)

      expect(last_transaction).to_not have_action
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
appsignal-4.0.6-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.6 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.5-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.5 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.4-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.4 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.3-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.3 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.2-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.2 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.1-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.1 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.0-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.0 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-3.13.1-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-3.13.1 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-3.13.1.alpha.1-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-3.13.1.alpha.1 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.0.beta.2-java spec/lib/appsignal/rack/instrumentation_middleware_spec.rb
appsignal-4.0.0.beta.2 spec/lib/appsignal/rack/instrumentation_middleware_spec.rb