Skip to content

Commit

Permalink
Better spec skipping helper
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Aug 31, 2024
1 parent bdda7e9 commit 58906a5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sentry-ruby/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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
Expand Down

0 comments on commit 58906a5

Please sign in to comment.