Class Object
In: lib/expectations/blank_slate.rb
lib/expectations/object.rb
Parent: Object

Same as above, except in Object.

Methods

Included Modules

MochaExpectsMethod ExpectationsExpectsMethod InstanceExecMethods

Classes and Modules

Module Object::ExpectationsExpectsMethod
Module Object::MochaExpectsMethod
Class Object::Not

Attributes

__which_expects__  [RW] 

Public Class methods

[Source]

    # File lib/expectations/blank_slate.rb, line 89
89:     def find_hidden_method(name)
90:       nil
91:     end

Public Instance methods

[Source]

    # File lib/expectations/object.rb, line 47
47:   def expectations_equal_to(other)
48:     self == other
49:   end

[Source]

    # File lib/expectations/object.rb, line 19
19:   def expects(*args)
20:     (__which_expects__ || MochaExpectsMethod).instance_method(:expects).bind(self).call(*args)
21:   end

Evaluate the block with the given arguments within the context of this object, so self is set to the method receiver.

From Mauricio’s eigenclass.org/hiki/bounded+space+instance_exec

[Source]

    # File lib/expectations/object.rb, line 60
60:     def instance_exec(*args, &block)
61:       begin
62:         old_critical, Thread.critical = Thread.critical, true
63:         n = 0
64:         n += 1 while respond_to?(method_name = "__instance_exec#{n}")
65:         InstanceExecMethods.module_eval { define_method(method_name, &block) }
66:       ensure
67:         Thread.critical = old_critical
68:       end
69: 
70:       begin
71:         send(method_name, *args)
72:       ensure
73:         InstanceExecMethods.module_eval { remove_method(method_name) } rescue nil
74:       end
75:     end

[Source]

    # File lib/expectations/object.rb, line 27
27:   def not
28:     Not.new(self)
29:   end

[Source]

    # File lib/expectations/object.rb, line 31
31:   def not!
32:     !self
33:   end

[Source]

    # File lib/expectations/object.rb, line 23
23:   def to
24:     Expectations::Recorder.new(self)
25:   end

[Validate]