Class: Sus::Receive::WithBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/sus/receive.rb

Overview

Represents a constraint on method call block argument.

Instance Method Summary collapse

Constructor Details

#initialize(predicate) ⇒ WithBlock

Initialize a new WithBlock constraint.



227
228
229
# File 'lib/sus/receive.rb', line 227

def initialize(predicate)
	@predicate = predicate
end

Instance Method Details

#call(assertions, subject) ⇒ Object

Evaluate this constraint against a block.



240
241
242
243
244
245
# File 'lib/sus/receive.rb', line 240

def call(assertions, subject)
	assertions.nested(self) do |assertions|
		
		Expect.new(assertions, subject).not.to(Be == nil)
	end
end

Print a representation of this constraint.



233
234
235
# File 'lib/sus/receive.rb', line 233

def print(output)
	output.write("with block", @predicate)
end