Sha256: a1cf400aadd8d366fc7786eddfb670ff96841ef865f58fdc01cebe72d75c7172
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
RSpec.describe Airbrake::Rack do after { Airbrake::Rack::RequestStore.clear } describe ".timing" do let(:routes) { Airbrake::Rack::RequestStore[:routes] } context "when request store doesn't have any routes" do it "doesn't store timing" do described_class.capture_timing('operation') {} expect(Airbrake::Rack::RequestStore.store).to be_empty end it "returns the value of the block" do expect(described_class.capture_timing('operation') { 1 }).to eq(1) end end context "when request store has a route" do before do Airbrake::Rack::RequestStore[:routes] = { '/about' => { method: 'GET', response_type: :html, groups: {} } } end it "attaches all timings for different operations to the request store" do described_class.capture_timing('operation 1') {} described_class.capture_timing('operation 2') {} described_class.capture_timing('operation 3') {} expect(routes['/about'][:groups]).to match( 'operation 1' => be > 0, 'operation 2' => be > 0, 'operation 3' => be > 0 ) end it "returns the value of the block" do expect(described_class.capture_timing('operation') { 1 }).to eq(1) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
airbrake-9.2.1 | spec/unit/rack/rack_spec.rb |
airbrake-9.2.0 | spec/unit/rack/rack_spec.rb |