File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -291,20 +291,27 @@ describe('The mach library', function()
291
291
end )
292
292
end )
293
293
294
- it (' should fail if and_will_return is not preceeded by should_be_called or should_be_called_with ' , function ()
294
+ it (' should fail if and_will_return is not preceeded by an expected call ' , function ()
295
295
should_fail_with (' cannot set return value for an unspecified call' , function ()
296
296
local f = mach .mock_function (' f' )
297
297
f :and_will_return (1 )
298
298
end )
299
299
end )
300
300
301
- it (' should fail if when is not preceeded by should_be_called or should_be_called_with' , function ()
301
+ it (' should fail if and_will_raise_error is not preceeded by an expected call' , function ()
302
+ should_fail_with (' cannot set error for an unspecified call' , function ()
303
+ local f = mach .mock_function (' f' )
304
+ f :and_will_raise_error (1 )
305
+ end )
306
+ end )
307
+
308
+ it (' should fail if when is not preceeded by an expected call' , function ()
302
309
should_fail_with (' incomplete expectation' , function ()
303
310
f :when (function () end )
304
311
end )
305
312
end )
306
313
307
- it (' should fail if after is not preceeded by should_be_called or should_be_called_with ' , function ()
314
+ it (' should fail if after is not preceeded by an expected call ' , function ()
308
315
should_fail_with (' incomplete expectation' , function ()
309
316
f :after (function () end )
310
317
end )
Original file line number Diff line number Diff line change @@ -29,9 +29,9 @@ function expectation:and_will_return(...)
29
29
end
30
30
31
31
function expectation :and_will_raise_error (...)
32
- -- if not self._call_specified then
33
- -- error('cannot set return value for an unspecified call', 2)
34
- -- end
32
+ if not self ._call_specified then
33
+ error (' cannot set error for an unspecified call' , 2 )
34
+ end
35
35
36
36
self ._calls [# self ._calls ]:set_error (... )
37
37
You can’t perform that action at this time.
0 commit comments