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
Michael Miller
18b3879dce
Treat symbols and non-symbols the same
2019-11-11 20:59:33 -07:00
Michael Miller
fd2c6d3d8c
Remove reference to test
...
Disallows group context values being used within double definitions.
This had an adverse effect where context values could be called on the
double (dbl.foo).
2019-11-11 20:59:12 -07:00
Michael Miller
96aae8f6d5
Use harness variable
2019-11-10 13:49:10 -07:00
Michael Miller
6c0693f2a4
Add default stubs from parent contexts
2019-11-10 13:22:18 -07:00
Michael Miller
d2e27d1e6e
Pass test context to registry
2019-11-10 13:08:43 -07:00
Michael Miller
2bc4f71edb
Add stubs in reverse order
2019-11-10 13:04:28 -07:00
Michael Miller
4fea5ea435
Add ability to define default stub for mocks
2019-11-10 12:49:36 -07:00
Michael Miller
eb1a99b3ab
Fix deque creation
2019-11-10 12:49:24 -07:00
Michael Miller
14876a8e9a
Add default stubs to TestContext
...
Pass default stubs into mocks registry on example startup.
2019-11-10 12:35:03 -07:00
Michael Miller
a2b72eaa36
Implement allow_any_instance_of
2019-11-10 09:46:23 -07:00
Michael Miller
f816a64770
Resolve issue with harness trying to be used outside of test
2019-11-10 07:27:59 -07:00
Michael Miller
11ea7bf2ce
Move mock containment to harness
2019-11-09 23:22:21 -07:00
Michael Miller
e4aae1f60a
Change Registry to a class
2019-11-09 23:05:22 -07:00
Michael Miller
e0d12e9d0d
Use class name instead of hash of type
...
Hash of type could collide, though unlikely.
2019-11-09 22:32:49 -07:00
Michael Miller
0471794814
Store stubs in reverse order
2019-11-09 22:13:02 -07:00
Michael Miller
17695d35cf
Fix cast to nil when nil is expected
...
Resolves `TypeCastError: The return type of stub #... : Nil at ...:##
doesn't match the expected type Nil`
2019-11-09 21:30:59 -07:00
Michael Miller
e9f7e65ac9
Add mock registry prep
2019-11-09 10:49:29 -07:00
Michael Miller
74eb4fc11a
Reset stubs after each test
2019-11-09 10:39:02 -07:00
Michael Miller
c03808dfce
Handle super vs previous_def
2019-11-09 09:45:57 -07:00
Michael Miller
66dc6bf098
Uncomment predicate matcher
2019-11-09 09:38:11 -07:00
Michael Miller
48363951c2
Update receive matchers to use registry
2019-11-09 09:23:01 -07:00
Michael Miller
9e8286f892
Move double info to registry
2019-11-09 09:18:34 -07:00
Michael Miller
5a072301af
Don't require registration
2019-11-09 09:15:41 -07:00
Michael Miller
fc0b46caca
Use Registry for storing stubs
2019-11-09 09:08:09 -07:00
Michael Miller
aa33acd14e
Anything can be passed to allow()
2019-11-09 09:07:54 -07:00
Michael Miller
8262bb0316
Rename OpenMock to Allow
2019-11-09 09:05:17 -07:00
Michael Miller
0698ed655d
Switch to using Registry for mocks and fix various issues
2019-11-09 09:03:36 -07:00
Michael Miller
8c2f8d973b
Don't embed mock info in type
...
This can cause problems. Need to use a registry approach.
2019-11-09 09:03:07 -07:00
Michael Miller
875333cffe
Initial mock registry code
2019-11-06 21:02:24 -07:00
Michael Miller
cf8e028bd9
Some updates to mocks
...
Not working correctly for some cases, specifically String.
The default stub can seriously mess up Crystal internals.
It looks like the stubs and spy information will need to be kept outside
the instance.
2019-11-03 15:07:25 -07:00
Michael Miller
db09274746
Forgot to check-in argument matcher
2019-11-03 14:50:51 -07:00
Michael Miller
e3b9cef221
Remove type restriction
...
Not sure if this will blow up the type resolution, but seems to fix
argument comparison from recorded calls.
2019-11-03 14:49:10 -07:00
Michael Miller
82e01e44de
Copy-paste and tweak to implement argument expectations
2019-11-03 14:48:08 -07:00