Class: Expects::Handlers::Proc

Inherits:
Expects::Handler show all
Includes:
Expects
Defined in:
lib/expects/handlers/proc.rb

Constant Summary

Constants included from Expects

VERSION

Instance Attribute Summary

Attributes inherited from Expects::Handler

#objects, #subject

Instance Method Summary collapse

Methods included from Expects

included

Methods inherited from Expects::Handler

#accept!, #reject!

Constructor Details

#initialize(subject, objects) ⇒ Proc

Returns a new instance of Proc.



6
7
8
9
# File 'lib/expects/handlers/proc.rb', line 6

def initialize(subject, objects)
  expects objects, ::Proc
  super
end

Instance Method Details

#build_messageObject



15
16
17
# File 'lib/expects/handlers/proc.rb', line 15

def build_message
  "Expected #{@subject.inspect} to get a true from the proc"
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/expects/handlers/proc.rb', line 11

def valid?
  @objects.call(@subject)
end