@@ -10,39 +10,39 @@ describe('The mock library', function()
10
10
it (' should allow you to verify that a function is called' , function ()
11
11
local m = moq .createMockFunction ()
12
12
13
- moq . mock (m ):shouldBeCalled ():
13
+ moq (m ):shouldBeCalled ():
14
14
when (function () m () end )
15
15
end )
16
16
17
17
it (' should alert you when a function is not called' , function ()
18
18
shouldFail (function ()
19
19
local m = moq .createMockFunction ()
20
20
21
- moq . mock (m ):shouldBeCalled ():
21
+ moq (m ):shouldBeCalled ():
22
22
when (function () end )
23
23
end )
24
24
end )
25
25
26
26
it (' should allow you to verify that a function has been called with the correct arguments' , function ()
27
27
local m = moq .createMockFunction ()
28
28
29
- moq . mock (m ):shouldBeCalledWith (1 , ' 2' ):
29
+ moq (m ):shouldBeCalledWith (1 , ' 2' ):
30
30
when (function () m (1 , ' 2' ) end )
31
31
end )
32
32
33
33
it (' should alert you when a function has been called with incorrect arguments' , function ()
34
34
shouldFail (function ()
35
35
local m = moq .createMockFunction ()
36
36
37
- moq . mock (m ):shouldBeCalledWith (1 , ' 2' ):
37
+ moq (m ):shouldBeCalledWith (1 , ' 2' ):
38
38
when (function () m (1 , ' 3' ) end )
39
39
end )
40
40
end )
41
41
42
42
it (' should allow you to specify the return value of a mocked function' , function ()
43
43
local m = moq .createMockFunction ()
44
44
45
- moq . mock (m ):shouldBeCalled ():andWillReturn (4 ):
45
+ moq (m ):shouldBeCalled ():andWillReturn (4 ):
46
46
when (function ()
47
47
assert .is .equal (m (), 4 )
48
48
end )
@@ -51,7 +51,7 @@ describe('The mock library', function()
51
51
it (' should allow you to specify multiple return values for a mocked function' , function ()
52
52
local m = moq .createMockFunction ()
53
53
54
- moq . mock (m ):shouldBeCalled ():andWillReturn (1 , 2 ):
54
+ moq (m ):shouldBeCalled ():andWillReturn (1 , 2 ):
55
55
when (function ()
56
56
r1 , r2 = m ()
57
57
assert .is .equal (r1 , 1 )
@@ -62,8 +62,8 @@ describe('The mock library', function()
62
62
it (' should allow you to check that a function has been called multiple times' , function ()
63
63
local m = moq .createMockFunction ()
64
64
65
- moq . mock (m ):shouldBeCalled ():
66
- andAlso (moq . mock (m ):shouldBeCalledWith (1 , 2 , 3 )):
65
+ moq (m ):shouldBeCalled ():
66
+ andAlso (moq (m ):shouldBeCalledWith (1 , 2 , 3 )):
67
67
when (function ()
68
68
m ()
69
69
m (1 , 2 , 3 )
@@ -74,8 +74,8 @@ describe('The mock library', function()
74
74
local m1 = moq .createMockFunction ()
75
75
local m2 = moq .createMockFunction ()
76
76
77
- moq . mock (m1 ):shouldBeCalled ():
78
- andAlso (moq . mock (m2 ):shouldBeCalledWith (1 , 2 , 3 )):
77
+ moq (m1 ):shouldBeCalled ():
78
+ andAlso (moq (m2 ):shouldBeCalledWith (1 , 2 , 3 )):
79
79
when (function ()
80
80
m1 ()
81
81
m2 (1 , 2 , 3 )
@@ -86,9 +86,9 @@ describe('The mock library', function()
86
86
local m1 = moq .createMockFunction ()
87
87
local m2 = moq .createMockFunction ()
88
88
89
- moq . mock (m1 ):shouldBeCalled ():
90
- andAlso (moq . mock (m2 ):shouldBeCalledWith (1 , 2 , 3 )):
91
- andThen (moq . mock (m2 ):shouldBeCalledWith (1 ):andWillReturn (4 )):
89
+ moq (m1 ):shouldBeCalled ():
90
+ andAlso (moq (m2 ):shouldBeCalledWith (1 , 2 , 3 )):
91
+ andThen (moq (m2 ):shouldBeCalledWith (1 ):andWillReturn (4 )):
92
92
when (function ()
93
93
m1 ()
94
94
m2 (1 , 2 , 3 )
@@ -101,11 +101,11 @@ describe('The mock library', function()
101
101
local m2 = moq .createMockFunction ()
102
102
103
103
function somethingShouldHappen ()
104
- return moq . mock (m1 ):shouldBeCalled ()
104
+ return moq (m1 ):shouldBeCalled ()
105
105
end
106
106
107
107
function anotherThingShouldHappen ()
108
- return moq . mock (m2 ):shouldBeCalledWith (1 , 2 , 3 )
108
+ return moq (m2 ):shouldBeCalledWith (1 , 2 , 3 )
109
109
end
110
110
111
111
function codeUnderTestRuns ()
@@ -126,8 +126,8 @@ describe('The mock library', function()
126
126
127
127
mockedTable = moq .createMockTable (someTable )
128
128
129
- moq . mock (mockedTable .foo ):shouldBeCalledWith (1 ):andWillReturn (2 ):
130
- andAlso (moq . mock (mockedTable .bar ):shouldBeCalled ()):
129
+ moq (mockedTable .foo ):shouldBeCalledWith (1 ):andWillReturn (2 ):
130
+ andAlso (moq (mockedTable .bar ):shouldBeCalled ()):
131
131
when (function ()
132
132
mockedTable .foo (1 )
133
133
mockedTable .bar ()
@@ -142,7 +142,7 @@ describe('The mock library', function()
142
142
143
143
mockedTable = moq .createMockTable (someTable )
144
144
145
- moq . mock (mockedTable .foo ):shouldBeCalledWith (1 ):andWillReturn (2 ):
145
+ moq (mockedTable .foo ):shouldBeCalledWith (1 ):andWillReturn (2 ):
146
146
when (function ()
147
147
mockedTable :foo (1 )
148
148
end )
@@ -157,8 +157,8 @@ describe('The mock library', function()
157
157
158
158
mockedObject = moq .createMockObject (someObject )
159
159
160
- moq . mock (mockedObject .foo ):shouldBeCalledWith (1 ):andWillReturn (2 ):
161
- andAlso (moq . mock (mockedObject .bar ):shouldBeCalled ()):
160
+ moq (mockedObject .foo ):shouldBeCalledWith (1 ):andWillReturn (2 ):
161
+ andAlso (moq (mockedObject .bar ):shouldBeCalled ()):
162
162
when (function ()
163
163
mockedObject :foo (1 )
164
164
mockedObject :bar ()
@@ -173,7 +173,7 @@ describe('The mock library', function()
173
173
174
174
mockedObject = moq .createMockObject (someObject )
175
175
176
- moq . mock (mockedObject .foo ):shouldBeCalledWith (1 ):andWillReturn (2 ):
176
+ moq (mockedObject .foo ):shouldBeCalledWith (1 ):andWillReturn (2 ):
177
177
when (function ()
178
178
mockedObject .foo (1 )
179
179
end )
0 commit comments