File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,12 @@ def stubba_method_for(method_name)
73
73
#
74
74
# @see Mock#expects
75
75
def expects ( expected_methods_vs_return_values )
76
- anticipates ( expected_methods_vs_return_values )
76
+ if frozen?
77
+ raise StubbingError . new ( "can't stub method on frozen object: #{ mocha_inspect } " , caller )
78
+ end
79
+ mocha . anticipates ( expected_methods_vs_return_values , caller ) do |method_name |
80
+ Mockery . instance . stub_method ( self , method_name )
81
+ end
77
82
end
78
83
79
84
# Adds an expectation that the specified method may be called any number of times with any parameters.
@@ -105,7 +110,7 @@ def expects(expected_methods_vs_return_values)
105
110
#
106
111
# @see Mock#stubs
107
112
def stubs ( stubbed_methods_vs_return_values )
108
- anticipates ( stubbed_methods_vs_return_values ) . at_least ( 0 )
113
+ expects ( stubbed_methods_vs_return_values ) . at_least ( 0 )
109
114
end
110
115
111
116
# Removes the specified stubbed methods (added by calls to {#expects} or {#stubs}) and all expectations associated with them.
@@ -137,16 +142,5 @@ def unstub(*method_names)
137
142
mockery . stubba . unstub ( stubba_method_for ( method_name ) )
138
143
end
139
144
end
140
-
141
- private
142
-
143
- def anticipates ( expected_methods_vs_return_values )
144
- if frozen?
145
- raise StubbingError . new ( "can't stub method on frozen object: #{ mocha_inspect } " , caller )
146
- end
147
- mocha . anticipates ( expected_methods_vs_return_values , caller ) do |method_name |
148
- Mockery . instance . stub_method ( self , method_name )
149
- end
150
- end
151
145
end
152
146
end
You can’t perform that action at this time.
0 commit comments