Commit graph

1350 commits

Author SHA1 Message Date
Michael Miller
b896a7f1d5 Implement stub that raises 2019-11-17 12:53:18 -07:00
Michael Miller
6e287f864b Implement returning multiple values 2019-11-17 12:26:02 -07:00
Michael Miller
1a3f663b70 Name is optional for doubles 2019-11-17 10:47:51 -07:00
Michael Miller
a63d3d05a5 Negation for receive matchers 2019-11-17 10:32:37 -07:00
Michael Miller
5da231a5e8 Check expectations for anonymous double 2019-11-17 10:14:03 -07:00
Michael Miller
45fe6217b4 Missing args 2019-11-17 09:42:19 -07:00
Michael Miller
ac9b3ad1fe Implement expect_any_instance_of 2019-11-16 21:27:18 -07:00
Michael Miller
a15e2a97b1 Allow deferred expectation of multiple stubs 2019-11-16 15:24:23 -07:00
Michael Miller
a8e0f46645 Revert "Coerce operations in match? to booleans"
This reverts commit 76c21d447a.

Should no longer be needed since mocks and doubles should indirectly leak into StandardMatcher types.
2019-11-16 15:15:53 -07:00
Michael Miller
d9d30c57d0 Merge ReceiveArgumentsMatcher and ReceiveMatcher
Finally found the issue causing other matchers derived from
StandardMatcher to be "leaked" doubles and mocks indirectly.
The if-condition in ExpectationPartial#to and #to_not caused the matcher
to be given the StandardMatcher type instead of a union type.
This lead to really strange compilation errors and wasted a lot of
hours.
2019-11-16 15:14:38 -07:00
Michael Miller
f0bfd8b6d4 Switch to run-time error for unsupported negation 2019-11-16 13:18:09 -07:00
Michael Miller
201fe614d1 Expect messages on double, but don't stub them 2019-11-16 10:59:13 -07:00
Michael Miller
186fa15a1a Add method to check for stub 2019-11-16 10:06:11 -07:00
Michael Miller
8dbfb2d6ec Revert "Allow expected value to receive stub"
This reverts commit 6cd410c4c7.

Should not stub the method.
The end-user needs to do this.
2019-11-16 09:23:45 -07:00
Michael Miller
c9fb4d2d33 Don't run deferred blocks if the test fails
This also prevents overriding the test's original error with on that may 
occur in the deferred blocks.
2019-11-16 09:06:47 -07:00
Michael Miller
23d8f4b5a6 Formatting 2019-11-16 09:03:24 -07:00
Michael Miller
ca85acefaf Resolve issue trying to splat union of named tuples 2019-11-16 09:02:57 -07:00
Michael Miller
85531fecf9 Fix truthy values not being strings 2019-11-16 09:01:03 -07:00
Michael Miller
76c21d447a Coerce operations in match? to booleans
The compiler is merging null-doubles with these matchers.
Methods that normally return a boolean instead return the instance 
(self).
This causes a return type-mismatch.
There should be a better alternative to this.
2019-11-16 08:49:09 -07:00
Michael Miller
6cd410c4c7 Allow expected value to receive stub 2019-11-16 08:32:13 -07:00
Michael Miller
72e4ac8fe9 Remove unnecessary free variables 2019-11-16 08:17:46 -07:00
Michael Miller
3c94d1f8fd Workaround for generic argument type issue 2019-11-15 21:18:51 -07:00
Michael Miller
2dc86c05ac Initial work on deferred have_received check 2019-11-14 19:35:13 -07:00
Michael Miller
98bfed2f83 Expose name and source 2019-11-14 19:17:55 -07:00
Michael Miller
ac3a5c8515 Store GenericArguments 2019-11-14 19:15:51 -07:00
Michael Miller
763c99f338 Formatting 2019-11-14 18:48:43 -07:00
Michael Miller
28ec1062e8 Merge branch 'release/0.9' into dev/mocks-and-doubles 2019-11-14 18:47:25 -07:00
Mike Miller
d1e401af96 Merge branch 'defer' into 'release/0.9'
Ability to defer expectations to after the test and hooks run

See merge request arctic-fox/spectator!23
2019-11-15 01:44:48 +00:00
Michael Miller
6b3885af30 Run deferred blocks 2019-11-14 18:41:26 -07:00
Michael Miller
2128184659 Implement defer logic in harness 2019-11-14 18:30:48 -07:00
Michael Miller
173f7bfa13 Add should_eventually and should_never methods 2019-11-14 18:26:24 -07:00
Michael Miller
a80d018ff6 Remove type annotation/requirement 2019-11-14 18:23:45 -07:00
Michael Miller
bd0396c001 Add to_eventually and to_never operations
This defines what they should look like.
2019-11-14 18:19:37 -07:00
Michael Miller
b40abe8057 Fix GenericArguments#to_s 2019-11-14 18:06:20 -07:00
Michael Miller
acad88204a Fix issues with creating anonymous null doubles 2019-11-14 17:55:56 -07:00
Michael Miller
e44f0229d6 Allow stubbing/overriding anonymous double methods 2019-11-14 17:12:27 -07:00
Michael Miller
b9fe1b6a60 Initial code to support anonymous doubles 2019-11-12 21:55:16 -07:00
Michael Miller
b0562981f7 Change double name to string 2019-11-12 21:54:55 -07:00
Michael Miller
38ec44c9ac Simplify type resolution code 2019-11-12 21:46:33 -07:00
Michael Miller
cb466b4ff5 Display better error when a double isn't found/defined 2019-11-12 21:44:35 -07:00
Michael Miller
87a60cf92a Split out double macros 2019-11-12 21:21:30 -07:00
Michael Miller
f50e71606e Make derived double names safer 2019-11-12 21:13:44 -07:00
Michael Miller
94e210c306 Implement null doubles 2019-11-11 23:40:08 -07:00
Michael Miller
48ea53c2f5 Formatting 2019-11-11 23:30:36 -07:00
Michael Miller
c3cba6962c Get stubs on class methods (self.) working 2019-11-11 23:30:30 -07:00
Michael Miller
233e9573de Placeholders for delayed message expectation 2019-11-11 22:36:29 -07:00
Michael Miller
20f68e956d Add receive_messages macro to stub multiple methods 2019-11-11 22:27:53 -07:00
Michael Miller
9c161a07ff Support for canned responses in double creation 2019-11-11 22:17:37 -07:00
Michael Miller
73e3f8fd66 Raise on non-defined methods 2019-11-11 22:11:58 -07:00
Michael Miller
925af7908b Raise UnexpectedMessageError 2019-11-11 22:08:36 -07:00