From 57b6fd9e0a2d495aa26922388cc15fd8a905bdf3 Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Mon, 24 Jun 2024 16:33:24 +0200 Subject: [PATCH] Fix CI for rack 3.1 --- .../spec/sentry/interfaces/request_interface_spec.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sentry-ruby/spec/sentry/interfaces/request_interface_spec.rb b/sentry-ruby/spec/sentry/interfaces/request_interface_spec.rb index e9570f520..580a610d3 100644 --- a/sentry-ruby/spec/sentry/interfaces/request_interface_spec.rb +++ b/sentry-ruby/spec/sentry/interfaces/request_interface_spec.rb @@ -1,7 +1,7 @@ -return unless defined?(Rack) - require 'spec_helper' +return unless defined?(Rack) + RSpec.describe Sentry::RequestInterface do let(:env) { Rack::MockRequest.env_for("/test") } let(:send_default_pii) { false } @@ -44,14 +44,16 @@ let(:env) { Rack::MockRequest.env_for("/test", additional_headers) } it 'transforms headers to conform with the interface' do - expect(subject.headers).to eq("Content-Length" => "0", "Version" => "HTTP/1.1", "X-Request-Id" => "12345678") + expect(subject.headers).to include("Version" => "HTTP/1.1", "X-Request-Id" => "12345678") + expect(subject.headers).not_to include("Cookie") end context 'from Rails middleware' do let(:additional_headers) { { "action_dispatch.request_id" => "12345678" } } it 'transforms headers to conform with the interface' do - expect(subject.headers).to eq("Content-Length" => "0", "X-Request-Id" => "12345678") + expect(subject.headers).to include("X-Request-Id" => "12345678") + expect(subject.headers).not_to include("Cookie") end end @@ -61,7 +63,7 @@ it "doesn't cause any issue" do json = JSON.generate(subject.to_hash) - expect(JSON.parse(json)["headers"]).to eq({ "Content-Length"=>"0", "Foo"=>"Tekirda�" }) + expect(JSON.parse(json)["headers"]).to include("Foo"=>"Tekirda�") end end