Skip to content

Commit dd29492

Browse files
committed
Fix diagnose test for JRuby 10
The patchlevel of the Ruby version is included in JRuby and MRI, but not in older versions of JRuby. Update the assertion to match.
1 parent 923100d commit dd29492

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

spec/lib/appsignal/cli/diagnose_spec.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,14 @@ def dont_accept_prompt_to_send_diagnostics_report
265265

266266
it "adds the installation report to the diagnostics report" do
267267
run
268-
jruby = Appsignal::System.jruby?
268+
is_jruby = Appsignal::System.jruby?
269+
with_patchlevel = DependencyHelper.running_jruby10? || !is_jruby
269270
language = {
270271
"name" => "ruby",
271-
"version" => "#{RUBY_VERSION}#{"-p#{rbconfig["PATCHLEVEL"]}" unless jruby}",
272-
"implementation" => jruby ? "jruby" : "ruby"
272+
"version" => "#{RUBY_VERSION}#{"-p#{rbconfig["PATCHLEVEL"]}" if with_patchlevel}",
273+
"implementation" => is_jruby ? "jruby" : "ruby"
273274
}
274-
language["implementation_version"] = JRUBY_VERSION if jruby
275+
language["implementation_version"] = JRUBY_VERSION if is_jruby
275276
expect(received_report["installation"]).to match(
276277
"result" => {
277278
"status" => "success"
@@ -289,7 +290,7 @@ def dont_accept_prompt_to_send_diagnostics_report
289290
"target" => Appsignal::System.agent_platform,
290291
"musl_override" => false,
291292
"linux_arm_override" => false,
292-
"library_type" => jruby ? "dynamic" : "static",
293+
"library_type" => is_jruby ? "dynamic" : "static",
293294
"source" => "remote",
294295
"dependencies" => kind_of(Hash),
295296
"flags" => kind_of(Hash),

spec/support/helpers/dependency_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ def running_jruby?
2525
Appsignal::System.jruby?
2626
end
2727

28+
def running_jruby10?
29+
Appsignal::System.jruby? && Gem::Version.new(JRUBY_VERSION) >= Gem::Version.new("10.0.0.0")
30+
end
31+
2832
def rails_present?
2933
dependency_present? "rails"
3034
end

0 commit comments

Comments
 (0)