Skip to content

Commit 18c76ce

Browse files
committed
Find datadog spec even when extensions are not built
`rubygems` started enforcing extensions to be built via `Gem::Specification#ignored?`. This causes the `datadog` spec lookup via `Gem::Specification.find_by_name` to fail. Since in this case we don't care for the extension, replace by `Gem.loaded_specs`, which is what matters there. Note that `Gem::SpecificationRecord.find_all_by_name` is not subject to the `ignored?` check, only `Specification.find_by_name` is (via `Gem::Dependency#to_spec`), so we could use that; unfortunately it is fairly recent and unavailable for older rubygems versions. See: - ruby/rubygems@c80998a - ruby/rubygems#8104 - #4511 (comment)
1 parent 0c03ef4 commit 18c76ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spec/datadog/tracing/contrib_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
RSpec.describe Datadog::Tracing::Contrib do
4-
root = Gem::Specification.find_by_name('datadog').gem_dir
4+
root = Gem.loaded_specs['datadog'].gem_dir
55

66
# Our module names are camelized directory name with some exceptions
77
mapping = {

0 commit comments

Comments
 (0)