Class: Spec::Matchers::Satisfy

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/rspec-1.1.12/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/gems/rspec-1.1.12/lib/spec/matchers/satisfy.rb', line 5

def initialize(&block)
  @block = block
end

Instance Method Details

#failure_messageObject



15
16
17
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/satisfy.rb', line 15

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

#matches?(given, &block) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/satisfy.rb', line 9

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

#negative_failure_messageObject



19
20
21
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/satisfy.rb', line 19

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