diff --git a/Gemfile b/Gemfile index 515440efe..c4344ea66 100644 --- a/Gemfile +++ b/Gemfile @@ -9,10 +9,7 @@ ruby_version = Gem::Version.new(RUBY_VERSION) if ruby_version >= Gem::Version.new("2.7.0") gem "debug", github: "ruby/debug", platform: :ruby gem "irb" - - if ruby_version >= Gem::Version.new("3.0.0") - gem "ruby-lsp-rspec" - end + gem "ruby-lsp-rspec" if ruby_version >= Gem::Version.new("3.0.0") && RUBY_PLATFORM != "java" end # For RSpec 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