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
Michael Miller
4acf6aaa58
Add range to description and failure message
2019-11-03 14:28:57 -07:00
Michael Miller
46aff9e11c
Add utility methods for setting count
2019-11-03 14:00:40 -07:00
Michael Miller
dabd3a7658
Use ranges to specify call count
2019-11-03 13:59:38 -07:00
Michael Miller
2048267eef
Allow specifying receive count
...
Updated checks and failure output to support this.
2019-11-03 13:22:00 -07:00
Michael Miller
b107511c9e
Include stub source in to_s
2019-11-03 13:13:54 -07:00
Michael Miller
59884f253f
Better handling of casting with covariance and contravariance
2019-11-03 13:04:44 -07:00
Michael Miller
2a484d5816
Fix return type
2019-11-03 12:07:21 -07:00
Michael Miller
f1a7018718
Remove unnecessary initializer
2019-11-03 12:05:26 -07:00
Michael Miller
9294599440
Basic to_s for stubs
2019-11-03 11:59:12 -07:00
Michael Miller
d1b54ad48f
Better error for when stubs don't match return type
2019-11-03 11:56:04 -07:00
Michael Miller
e6c1a6b2d2
Fix arg passing and implement arg matching
2019-11-03 11:42:31 -07:00
Michael Miller
1756670710
Add to_s method
2019-11-03 11:42:07 -07:00
Michael Miller
477271d297
Use NilMethodStub by default
...
Provides one place that #with can be defined and enforces ordering.
2019-11-03 11:23:04 -07:00
Michael Miller
af9104dfe4
Store arguments in method stub
...
Needed for matching arguments (setting constraints).
2019-11-03 11:18:46 -07:00
Michael Miller
20b80cc85a
Formatting
2019-11-03 10:07:32 -07:00
Michael Miller
cab9366fe8
Merge branch 'dev/mocks-and-doubles' of gitlab.com:arctic-fox/spectator into dev/mocks-and-doubles
2019-11-03 10:07:11 -07:00
Michael Miller
3931f420fe
Formatting
2019-11-03 10:03:09 -07:00
Michael Miller
5b143cb72c
Change structure around
2019-11-03 10:02:53 -07:00
Michael Miller
c95e228bde
Move mocks to their own module
2019-11-03 09:44:32 -07:00
Michael Miller
0c7de3d0d1
Merge branch 'dev/mocks-and-doubles' of gitlab.com:arctic-fox/spectator into dev/mocks-and-doubles
2019-11-02 19:58:56 -06:00
Michael Miller
42aaae7908
Some initial work on mocks
2019-11-02 19:58:47 -06:00
Michael Miller
541dc661ca
Only accept exact parameters, don't use splats
2019-11-02 09:45:34 -06:00
Michael Miller
e035afa85f
Rework let and subject to allow super
...
This addresses https://gitlab.com/arctic-fox/spectator/issues/32
2019-10-24 20:47:48 -06:00
Michael Miller
3dd691a990
Record call to stub
2019-10-13 18:50:19 -06:00
Michael Miller
76fa7e294f
Friendlier descriptions of objects
2019-10-13 18:49:22 -06:00
Michael Miller
d422376aaf
Initial work on have_received matcher
2019-10-13 18:41:10 -06:00
Michael Miller
8cbe2edf30
Formatting
2019-10-13 17:36:55 -06:00
Michael Miller
b09898d131
Rename @stubs to @spectator_stubs
2019-10-13 11:36:31 -06:00
Michael Miller
3befc8001b
Basics of stubbing is done
...
Still need to handle some features of yielding.
Also needs error handling.
2019-10-13 11:21:23 -06:00
Michael Miller
aecdb514b3
Implement basic and_return
2019-10-12 22:35:07 -06:00
Michael Miller
27bc976ae3
Try handling different method signatures and blocks
2019-10-12 21:30:20 -06:00
Michael Miller
211050650e
Remove internal double class
...
Stub handling method should be called from nested methods.
2019-10-12 21:08:49 -06:00
Michael Miller
c80a28d616
More work on method stubs
2019-10-12 20:53:17 -06:00
Michael Miller
0b6465e6bc
Started playing around with method stubs
2019-10-12 16:30:46 -06:00