Class: RSpec::Maybes::MaybeHandler

Inherits:
Expectations::PositiveExpectationHandler
  • Object
show all
Defined in:
lib/rspec/maybes/handlers.rb

Direct Known Subclasses

NegativeMaybeHandler, PositiveMaybeHandler

Class Method Summary collapse

Class Method Details

.handle_matcher(actual, initial_matcher, message = nil, &block) ⇒ Object


16
17
18
19
20
# File 'lib/rspec/maybes/handlers.rb', line 16

def self.handle_matcher(actual, initial_matcher, message = nil, &block)
  matcher = Expectations::ExpectationHelper.setup(self, initial_matcher, message)
  matcher.instance_variable_set(:@actual, actual)
  return matcher
end

.passes?(matcher) ⇒ Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/rspec/maybes/handlers.rb', line 22

def self.passes?(matcher)
  matcher.on_your_machine? || rand < 0.9
end