Sha256: 2aa9d21a002a8213e9eeb7f5f8094331d51848bd1cf7095aa7e2c3584ec35d4f

Contents?: true

Size: 1022 Bytes

Versions: 6

Compression:

Stored size: 1022 Bytes

Contents

describe Appsignal::Rack::GenericInstrumentation do
  let(:app) { double(:call => true) }
  let(:env) { Rack::MockRequest.env_for("/some/path") }
  let(:middleware) { Appsignal::Rack::GenericInstrumentation.new(app, {}) }

  before(:context) { 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_action.generic event" do
      make_request(env)

      expect(last_transaction.to_h).to include(
        "events" => [
          hash_including(
            "body" => "",
            "body_format" => Appsignal::EventFormatter::DEFAULT,
            "count" => 1,
            "name" => "process_action.generic",
            "title" => ""
          )
        ]
      )
    end
  end

  context "without action name metadata" do
    it "reports 'unknown' as the action name" do
      make_request(env)

      expect(last_transaction.to_h).to include("action" => "unknown")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
appsignal-3.9.2-java spec/lib/appsignal/rack/generic_instrumentation_spec.rb
appsignal-3.9.2 spec/lib/appsignal/rack/generic_instrumentation_spec.rb
appsignal-3.9.1-java spec/lib/appsignal/rack/generic_instrumentation_spec.rb
appsignal-3.9.1 spec/lib/appsignal/rack/generic_instrumentation_spec.rb
appsignal-3.9.0-java spec/lib/appsignal/rack/generic_instrumentation_spec.rb
appsignal-3.9.0 spec/lib/appsignal/rack/generic_instrumentation_spec.rb