Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 2 additions & 26 deletions spec/datadog/tracing/contrib/http/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -348,19 +348,7 @@ def expect_request_without_distributed_headers
let(:span) { spans.last }

it 'adds distributed tracing headers' do
# The block syntax only works with Ruby < 2.3 and the hash syntax
# only works with Ruby >= 2.3, so we need to support both.
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
expect(WebMock).to(
have_requested(:get, "#{uri}#{path}").with { |req|
distributed_tracing_headers.all? do |(header, value)|
req.headers[header.split('-').map(&:capitalize).join('-')] == value.to_s
end
}
)
else
expect(WebMock).to have_requested(:get, "#{uri}#{path}").with(headers: distributed_tracing_headers)
end
expect(WebMock).to have_requested(:get, "#{uri}#{path}").with(headers: distributed_tracing_headers)
end
end

Expand Down Expand Up @@ -394,19 +382,7 @@ def expect_request_without_distributed_headers
let(:span) { spans.last }

it 'adds distributed tracing headers' do
# The block syntax only works with Ruby < 2.3 and the hash syntax
# only works with Ruby >= 2.3, so we need to support both.
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
expect(WebMock).to(
have_requested(:get, "#{uri}#{path}").with { |req|
distributed_tracing_headers.all? do |(header, value)|
req.headers[header.split('-').map(&:capitalize).join('-')] == value.to_s
end
}
)
else
expect(WebMock).to have_requested(:get, "#{uri}#{path}").with(headers: distributed_tracing_headers)
end
expect(WebMock).to have_requested(:get, "#{uri}#{path}").with(headers: distributed_tracing_headers)
end
end

Expand Down
Loading