diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2ad427d..0cb2548d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,10 +22,10 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["3.1", "3.0", "2.7", "2.6"] + ruby: ["3.2", "3.1", "3.0", "2.7", "2.6"] redis: ["5.x"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} diff --git a/.rubocop.yml b/.rubocop.yml index 3d575f38..f9594b80 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,9 @@ inherit_gem: rubocop-discourse: default.yml +RSpec/ContextWording: + Enabled: false + RSpec/MessageSpies: Enabled: false diff --git a/lib/mini_profiler/profiler.rb b/lib/mini_profiler/profiler.rb index 674b8433..96d518d7 100644 --- a/lib/mini_profiler/profiler.rb +++ b/lib/mini_profiler/profiler.rb @@ -347,12 +347,7 @@ def call(env) env['HTTP_ACCEPT_ENCODING'] = 'identity' if config.suppress_encoding if query_string =~ /pp=(async-)?flamegraph/ || env['HTTP_REFERER'] =~ /pp=async-flamegraph/ - unless defined?(StackProf) && StackProf.respond_to?(:run) - headers = { 'Content-Type' => 'text/html' } - message = "Please install the stackprof gem and require it: add gem 'stackprof' to your Gemfile" - body.close if body.respond_to? :close - return client_settings.handle_cookie([500, headers, message]) - else + if defined?(StackProf) && StackProf.respond_to?(:run) # do not sully our profile with mini profiler timings current.measure = false match_data = query_string.match(/flamegraph_sample_rate=([\d\.]+)/) @@ -379,6 +374,11 @@ def call(env) ) do status, headers, body = @app.call(env) end + else + headers = { 'Content-Type' => 'text/html' } + message = "Please install the stackprof gem and require it: add gem 'stackprof' to your Gemfile" + body.close if body.respond_to? :close + return client_settings.handle_cookie([500, headers, message]) end elsif path == '/rack-mini-profiler/requests' blank_page_html = <<~HTML diff --git a/spec/lib/profiler_spec.rb b/spec/lib/profiler_spec.rb index eabe33ed..0a4d351b 100644 --- a/spec/lib/profiler_spec.rb +++ b/spec/lib/profiler_spec.rb @@ -100,7 +100,7 @@ def self.bar(baz, boo) end describe 'typical usage' do - before(:all) do + before do start = Process.clock_gettime(Process::CLOCK_MONOTONIC) clock_set(start) Rack::MiniProfiler.create_current @@ -122,7 +122,7 @@ def self.bar(baz, boo) @inner = @outer.children[0] end - after(:all) do + after do clock_back_to_normal end diff --git a/spec/lib/storage/redis_store_spec.rb b/spec/lib/storage/redis_store_spec.rb index 6b132fe5..447475be 100644 --- a/spec/lib/storage/redis_store_spec.rb +++ b/spec/lib/storage/redis_store_spec.rb @@ -153,7 +153,7 @@ describe 'diagnostics' do it "returns useful info" do res = store.diagnostics('a') - expected = "Redis prefix: MPRedisStore\nRedis location: 127.0.0.1:6379 db: 2\nunviewed_ids: []\n" + expected = "Redis prefix: MPRedisStore\nRedis location: localhost:6379 db: 2\nunviewed_ids: []\n" expect(res).to eq(expected) end end