Class: Micronaut::Matchers::Satisfy

Inherits:
Object
  • Object
show all
Defined in:
lib/micronaut/matchers/satisfy.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Satisfy

Returns a new instance of Satisfy.



6
7
8
# File 'lib/micronaut/matchers/satisfy.rb', line 6

def initialize(&block)
  @block = block
end

Instance Method Details

#failure_messageObject



16
17
18
# File 'lib/micronaut/matchers/satisfy.rb', line 16

def failure_message
  "expected #{@given} to satisfy block"
end

#matches?(given, &block) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/micronaut/matchers/satisfy.rb', line 10

def matches?(given, &block)
  @block = block if block
  @given = given
  @block.call(given)
end

#negative_failure_messageObject



20
21
22
# File 'lib/micronaut/matchers/satisfy.rb', line 20

def negative_failure_message
  "expected #{@given} not to satisfy block"
end