Class: SatisfactionAttemptVerifier
- Inherits:
-
Object
- Object
- SatisfactionAttemptVerifier
- Defined in:
- lib/object_protocol/rspec.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(&blk) ⇒ SatisfactionAttemptVerifier
constructor
A new instance of SatisfactionAttemptVerifier.
- #matches?(protocol) ⇒ Boolean
Constructor Details
#initialize(&blk) ⇒ SatisfactionAttemptVerifier
Returns a new instance of SatisfactionAttemptVerifier.
7 8 9 |
# File 'lib/object_protocol/rspec.rb', line 7 def initialize(&blk) @blk = blk end |
Instance Method Details
#failure_message ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/object_protocol/rspec.rb', line 18 def [ "expected", *protocol..flat_map(&" ".method(:+)), "to be satisfied by", *attempt..flat_map(&" ".method(:+)), ].join("\n") end |
#matches?(protocol) ⇒ Boolean
11 12 13 14 15 16 |
# File 'lib/object_protocol/rspec.rb', line 11 def matches?(protocol) @protocol = protocol @attempt = ObjectProtocol::SatisfactionAttempt.new(protocol, &blk) attempt.to_bool end |