debian-mirror-gitlab/spec/lib/gitlab/metrics/rack_middleware_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
749 B
Ruby
Raw Normal View History

2019-12-04 20:38:33 +05:30
# frozen_string_literal: true
2022-10-11 01:57:18 +05:30
require 'fast_spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Metrics::RackMiddleware do
let(:app) { double(:app) }
let(:middleware) { described_class.new(app) }
let(:env) { { 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/foo' } }
describe '#call' do
it 'tracks a transaction' do
expect(app).to receive(:call).with(env).and_return('yay')
expect(middleware.call(env)).to eq('yay')
end
2016-09-13 17:45:13 +05:30
it 'tracks any raised exceptions' do
expect(app).to receive(:call).with(env).and_raise(RuntimeError)
2017-09-10 17:25:29 +05:30
expect_any_instance_of(Gitlab::Metrics::Transaction)
.to receive(:add_event).with(:rails_exception)
2016-09-13 17:45:13 +05:30
expect { middleware.call(env) }.to raise_error(RuntimeError)
end
end
end