class WithBlock
Represents a constraint on method call block argument.
Definitions
def initialize(predicate)
Initialize a new WithBlock constraint.
Signature
-
parameter
predicateObject The predicate to match against the block.
Implementation
def initialize(predicate)
@predicate = predicate
end
def print(output)
Print a representation of this constraint.
Signature
-
parameter
outputOutput The output target.
Implementation
def print(output)
output.write("with block", @predicate)
end
def call(assertions, subject)
Evaluate this constraint against a block.
Signature
-
parameter
assertionsAssertions The assertions instance to use.
-
parameter
subjectProc, nil The block to check.
Implementation
def call(assertions, subject)
assertions.nested(self) do |assertions|
Expect.new(assertions, subject).to(@predicate)
end
end