Class: Object
Overview
Same as above, except in Object.
Defined Under Namespace
Modules: ExpectationsExpectsMethod, InstanceExecMethods, MochaExpectsMethod
Classes: Not
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#__which_expects__ ⇒ Object
Returns the value of attribute which_expects.
16
17
18
|
# File 'lib/expectations/object.rb', line 16
def __which_expects__
@__which_expects__
end
|
Class Method Details
.find_hidden_method(name) ⇒ Object
89
90
91
|
# File 'lib/expectations/blank_slate.rb', line 89
def find_hidden_method(name)
nil
end
|
Instance Method Details
#expectations_equal_to(other) ⇒ Object
47
48
49
|
# File 'lib/expectations/object.rb', line 47
def expectations_equal_to(other)
self == other
end
|
#expects(*args) ⇒ Object
19
20
21
|
# File 'lib/expectations/object.rb', line 19
def expects(*args)
(__which_expects__ || MochaExpectsMethod).instance_method(:expects).bind(self).call(*args)
end
|
#instance_exec(*args, &block) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/expectations/object.rb', line 60
def instance_exec(*args, &block)
begin
old_critical, Thread.critical = Thread.critical, true
n = 0
n += 1 while respond_to?(method_name = "__instance_exec#{n}")
InstanceExecMethods.module_eval { define_method(method_name, &block) }
ensure
Thread.critical = old_critical
end
begin
send(method_name, *args)
ensure
InstanceExecMethods.module_eval { remove_method(method_name) } rescue nil
end
end
|
27
28
29
|
# File 'lib/expectations/object.rb', line 27
def not
Not.new(self)
end
|
31
32
33
|
# File 'lib/expectations/object.rb', line 31
def not!
!self
end
|
23
24
25
|
# File 'lib/expectations/object.rb', line 23
def to
Expectations::Recorder.new(self)
end
|