From ca9210e577355055986d81cfc73a53ba1cbfc95b Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Thu, 22 Aug 2024 18:00:01 +0000 Subject: [PATCH] Better spec skipping helper --- sentry-ruby/spec/spec_helper.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sentry-ruby/spec/spec_helper.rb b/sentry-ruby/spec/spec_helper.rb index 2758a0a1f..f347f0664 100644 --- a/sentry-ruby/spec/spec_helper.rb +++ b/sentry-ruby/spec/spec_helper.rb @@ -47,9 +47,9 @@ end config.before(:each, when: true) do |example| - meth = example.metadata[:when] + meth, *args = example.metadata[:when] - skip("Skipping because `when: #{meth}` returned false") unless TestHelpers.public_send(meth, example) + skip("Skipping because `#{meth}(#{args.join(", ")})` returned false") unless TestHelpers.public_send(meth, *args) end RSpec::Matchers.define :have_recorded_lost_event do |reason, data_category, num: 1| @@ -60,13 +60,17 @@ end module TestHelpers - def self.stack_prof_installed?(_example) + def self.stack_prof_installed? defined?(StackProf) end - def self.rack_available?(_example) + def self.rack_available? defined?(Rack) end + + def self.ruby_version?(op, version) + RUBY_VERSION.public_send(op, version) + end end def fixtures_root