Skip to content

Commit

Permalink
Fix CI for rack 3.1 (#2327)
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py committed Jun 24, 2024
1 parent 389395e commit cfc2570
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 1 addition & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions sentry-ruby/spec/sentry/interfaces/request_interface_spec.rb
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit cfc2570

Please sign in to comment.