Skip to content

Commit

Permalink
Test Bundler installed gems methods
Browse files Browse the repository at this point in the history
Follow up of #1159

Silence the warning about calling an deprecated method because it
confuses me when I read the spec output.

Test against the new method as well.
  • Loading branch information
tombruijn committed Aug 26, 2024
1 parent 6335da6 commit d52f09e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions spec/lib/appsignal/environment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,26 @@ def inspect
end

describe ".report_supported_gems" do
it "reports about all AppSignal supported gems in the bundle" do
it "reports about all AppSignal supported gems in the bundle using Bundler all_specs" do
logs = capture_logs { described_class.report_supported_gems }

expect(logs).to be_empty

bundle_gem_specs = ::Bundler.rubygems.all_specs
bundle_gem_specs = silence { ::Bundler.rubygems.all_specs }
rack_spec = bundle_gem_specs.find { |s| s.name == "rack" }
rake_spec = bundle_gem_specs.find { |s| s.name == "rake" }
expect_environment_metadata("ruby_rack_version", rack_spec.version.to_s)
expect_environment_metadata("ruby_rake_version", rake_spec.version.to_s)
expect(rack_spec.version.to_s).to_not be_empty
expect(rake_spec.version.to_s).to_not be_empty
end

it "reports about all AppSignal supported gems in the bundle using bundler installed_specs" do
logs = capture_logs { described_class.report_supported_gems }

expect(logs).to be_empty

bundle_gem_specs = ::Bundler.rubygems.installed_specs
rack_spec = bundle_gem_specs.find { |s| s.name == "rack" }
rake_spec = bundle_gem_specs.find { |s| s.name == "rake" }
expect_environment_metadata("ruby_rack_version", rack_spec.version.to_s)
Expand Down

0 comments on commit d52f09e

Please sign in to comment.