Skip to content

Commit 4191a24

Browse files
authored
Merge pull request #4952 from RicardoTrindade/cleanup_version_check_request_spec
Remove ruby version check on http request spec
2 parents 1bff661 + 5f06563 commit 4191a24

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

spec/datadog/tracing/contrib/http/request_spec.rb

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -348,19 +348,7 @@ def expect_request_without_distributed_headers
348348
let(:span) { spans.last }
349349

350350
it 'adds distributed tracing headers' do
351-
# The block syntax only works with Ruby < 2.3 and the hash syntax
352-
# only works with Ruby >= 2.3, so we need to support both.
353-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
354-
expect(WebMock).to(
355-
have_requested(:get, "#{uri}#{path}").with { |req|
356-
distributed_tracing_headers.all? do |(header, value)|
357-
req.headers[header.split('-').map(&:capitalize).join('-')] == value.to_s
358-
end
359-
}
360-
)
361-
else
362-
expect(WebMock).to have_requested(:get, "#{uri}#{path}").with(headers: distributed_tracing_headers)
363-
end
351+
expect(WebMock).to have_requested(:get, "#{uri}#{path}").with(headers: distributed_tracing_headers)
364352
end
365353
end
366354

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

396384
it 'adds distributed tracing headers' do
397-
# The block syntax only works with Ruby < 2.3 and the hash syntax
398-
# only works with Ruby >= 2.3, so we need to support both.
399-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
400-
expect(WebMock).to(
401-
have_requested(:get, "#{uri}#{path}").with { |req|
402-
distributed_tracing_headers.all? do |(header, value)|
403-
req.headers[header.split('-').map(&:capitalize).join('-')] == value.to_s
404-
end
405-
}
406-
)
407-
else
408-
expect(WebMock).to have_requested(:get, "#{uri}#{path}").with(headers: distributed_tracing_headers)
409-
end
385+
expect(WebMock).to have_requested(:get, "#{uri}#{path}").with(headers: distributed_tracing_headers)
410386
end
411387
end
412388

0 commit comments

Comments
 (0)