File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -202,6 +202,22 @@ describe('The mach library', function()
202
202
end )
203
203
end )
204
204
205
+ it (' should allow a mocked object to be named' , function ()
206
+ mocked_object = mach .mock_object ({ foo = function () end }, ' some_object' )
207
+
208
+ should_fail_with (' unexpected function call some_object:foo()' , function ()
209
+ mocked_object .foo ()
210
+ end )
211
+ end )
212
+
213
+ it (' should give mocked objects a default name when none is provided' , function ()
214
+ mocked_object = mach .mock_object ({ foo = function () end })
215
+
216
+ should_fail_with (' unexpected function call <anonymous>:foo()' , function ()
217
+ mocked_object .foo ()
218
+ end )
219
+ end )
220
+
205
221
it (' should allow mocking of any callable in an object, not just functions' , function ()
206
222
local some_table = {
207
223
foo = {}
You can’t perform that action at this time.
0 commit comments