Class: RSpec::Matchers::BuiltIn::Satisfy

Inherits:
Object
  • Object
show all
Includes:
MatchAliases
Defined in:
lib/rspec/matchers/built_in/satisfy.rb

Instance Method Summary (collapse)

Methods included from MatchAliases

#==, #===

Constructor Details

- (Satisfy) initialize

A new instance of Satisfy

7
8
9
# File 'lib/rspec/matchers/built_in/satisfy.rb', line 7
def initialize(&block)
  @block = block
end

Instance Method Details

- (Object) description

25
26
27
# File 'lib/rspec/matchers/built_in/satisfy.rb', line 25
def description
  "satisfy block"
end

- (Object) failure_message_for_should

17
18
19
# File 'lib/rspec/matchers/built_in/satisfy.rb', line 17
def failure_message_for_should
  "expected #{@actual} to satisfy block"
end

- (Object) failure_message_for_should_not

21
22
23
# File 'lib/rspec/matchers/built_in/satisfy.rb', line 21
def failure_message_for_should_not
  "expected #{@actual} not to satisfy block"
end

- (Boolean) matches?(actual)

Returns:

  • (Boolean)
11
12
13
14
15
# File 'lib/rspec/matchers/built_in/satisfy.rb', line 11
def matches?(actual, &block)
  @block = block if block
  @actual = actual
  @block.call(actual)
end