From befb107942b3343d506a283723c72d5836291ba1 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Thu, 15 Aug 2024 18:56:12 +0100 Subject: [PATCH] Improve code coverage --- spec/yjit_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/yjit_spec.rb b/spec/yjit_spec.rb index 9147e66..0bd22c1 100644 --- a/spec/yjit_spec.rb +++ b/spec/yjit_spec.rb @@ -1,4 +1,5 @@ require "promenade/yjit/stats" +require "promenade/yjit/middleware" require "open3" RSpec.describe Promenade::YJIT::Stats do @@ -56,3 +57,17 @@ def parse_number(string) string.to_f end end + +RSpec.describe Promenade::YJIT::Middlware do + let(:app) { double(:app, call: nil) } + + it "is adds it's instrumentation method to the rack.after_reply array" do + stats = class_spy("Promenade::YJIT::Stats").as_stubbed_const + + after_reply = [] + described_class.new(app).call({ "rack.after_reply" => after_reply }) + after_reply.each(&:call) + + expect(stats).to have_received(:instrument) + end +end