Class: Spec::Matchers::Satisfy

Inherits:
Object
  • Object
show all
Defined in:
lib/vendor/plugins/rspec/lib/spec/matchers/satisfy.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Satisfy

Returns a new instance of Satisfy.



5
6
7
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/satisfy.rb', line 5

def initialize(&block)
  @block = block
end

Instance Method Details

#failure_message_for_shouldObject



15
16
17
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/satisfy.rb', line 15

def failure_message_for_should
  "expected #{@actual} to satisfy block"
end

#failure_message_for_should_notObject



19
20
21
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/satisfy.rb', line 19

def failure_message_for_should_not
  "expected #{@actual} not to satisfy block"
end

#matches?(actual, &block) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/vendor/plugins/rspec/lib/spec/matchers/satisfy.rb', line 9

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