Michael Miller
faff2933e6
Only capture splat if it has a name
2022-12-19 22:15:53 -07:00
Michael Miller
0f8c46d6ef
Support casting types with expect statements
2022-12-19 21:29:21 -07:00
Michael Miller
feaf1c6015
Bump version to 0.11.5
2022-12-18 19:15:25 -07:00
Michael Miller
fa99987780
Support creating instances of mocked modules via class
...
This is a bit of a hack.
The `.new` method is added to the module, which creates an instance that includes the mocked module.
No changes to the def_mock and new_mock methods are necessary.
For some reason, infinite recursion occurs when calling `.new` on the class.
To get around the issue for now, the internal method of allocation is used.
That is, allocate + initialize.
2022-12-18 16:04:49 -07:00
Michael Miller
e6584c9f04
Prevent comparing range arguments with non-compatible types in stubs
...
Addresses https://github.com/icy-arctic-fox/spectator/issues/48
2022-12-18 11:35:43 -07:00
Michael Miller
4b68b8e3de
Fix resolution issue when mocked types use custom types
...
GitLab issue 51 is affected.
https://gitlab.com/arctic-fox/spectator/-/issues/51
Private types cannot be referenced with mocks.
2022-12-17 20:56:16 -07:00
Michael Miller
149c0e6e4b
Don't use case-matching for proc arguments
...
A proc on the left side of === calls itself passing in the right side.
This causes typing issues and is easier to avoid for now.
Procs arguments are compared with standard equality (==) instead of case-equality (===).
2022-12-17 19:19:33 -07:00
Michael Miller
9f54a9e542
Additional handling for passing blocks
2022-12-17 19:16:38 -07:00
Michael Miller
7e2ec4ee37
Fix 0.11.4 in changelog
2022-12-13 22:59:42 -07:00
Michael Miller
952e949307
Handle 'self' and some other variants in method return types
2022-12-13 22:48:21 -07:00
Michael Miller
293faccd5c
Support free variables in mocked types
2022-12-13 18:22:22 -07:00
Michael Miller
275b217c6c
Allow metadata to be stored as nil
2022-11-29 23:22:42 -07:00
Michael Miller
1f98bf9ff1
Update CHANGELOG
2022-11-29 20:32:45 -07:00
Michael Miller
c256ef763e
Bump version to 0.11.4
2022-11-27 22:27:52 -07:00
Michael Miller
e2cdc9e08e
Re-enable logger after catching exit
...
The logger is closed during at-exit hooks that get invoked by Kernel's exit method.
2022-11-04 22:10:59 -06:00
Michael Miller
c00d2fe4e6
Update changelog
2022-11-04 16:57:06 -06:00
Michael Miller
baff1de1d8
Update changelog
...
Implemented https://github.com/icy-arctic-fox/spectator/issues/46
2022-10-23 22:37:41 -06:00
Michael Miller
090c95b162
Ensure stubs defined with allow syntax are cleared
2022-10-09 15:48:00 -06:00
Michael Miller
5c910e5a85
Clear stubs defined with expect().to receive()
syntax after test finishes
2022-10-09 13:57:28 -06:00
Michael Miller
4dfa5ccb6e
Prevent defining stubs on undefined methods in LazyDouble
...
In Crystal 1.6, a segfault would occur in the spec spec/spectator/mocks/lazy_double_spec.cr:238
I suspect this is a Crystal bug of some kind, but can't reduce it.
The methods produced by `method_missing` don't have a return type including Symbol.
Symbol is excluded from the union of return types (Int32 | String | Nil).
The program segfaults when calling a method on the actual value, which is a symbol.
It ultimately crashes when producing a failure message, which indicates the value it tested doesn't equal the expected value (a symbol of the same value).
Avoid this issue by preventing stubs on undefined/untyped methods.
2022-10-08 14:04:02 -06:00
Michael Miller
1998edbbb2
Release v0.11.3
2022-09-03 16:48:15 -06:00
Michael Miller
0505f210f9
Update CHANGELOG
2022-08-29 20:56:26 -06:00
Michael Miller
d10531430c
Bump v0.11.2
2022-08-07 15:23:05 -06:00
Michael Miller
b5c61f9003
Change -e
to use partial instead of exact match
...
Fixes https://gitlab.com/arctic-fox/spectator/-/issues/71
Fixes https://github.com/icy-arctic-fox/spectator/issues/45
2022-08-07 15:20:17 -06:00
Michael Miller
17a3ca3ac7
Fix https://gitlab.com/arctic-fox/spectator/-/issues/77
2022-08-07 14:58:09 -06:00
Michael Miller
02027cda53
Bump version 0.11.1
2022-07-18 19:48:43 -06:00
Michael Miller
18e9c1c35d
Workaround issue with Box.unbox causing segfault
...
Using Box.unbox on a nil value with a union type causes:
Invalid memory access (signal 11) at address 0x8
Related Crystal issue: https://github.com/crystal-lang/crystal/issues/11839
Fixes: https://gitlab.com/arctic-fox/spectator/-/issues/76
2022-07-18 19:47:34 -06:00
Michael Miller
61dee8d7db
Release v0.11.0
2022-07-14 20:51:48 -06:00
Michael Miller
0ba241221f
Update CHANGELOG
2022-07-12 23:37:13 -06:00
Michael Miller
0704fd2a48
Adjust evaluation order of change matcher expressions
...
Handles reference types better and matches RSpec more closely.
2022-05-14 23:30:15 -06:00
Michael Miller
35f8779ceb
Forward Example procsy to_s to example
...
https://gitlab.com/arctic-fox/spectator/-/issues/70
2022-02-22 16:36:16 -07:00
Michael Miller
cbe05cd637
Release v0.10.5
2022-01-27 13:04:03 -07:00
Michael Miller
92e839415d
Fix sample iteration with single block arg (not tuple)
2022-01-26 13:14:30 -07:00
Michael Miller
4e7318b964
Release v0.10.4
2022-01-11 16:40:53 -07:00
Michael Miller
4057089c20
Support multiple block arguments in sample block
...
https://github.com/icy-arctic-fox/spectator/issues/41#issuecomment-1010192486
2022-01-11 15:53:53 -07:00
Michael Miller
35628fbbfc
Update changelog
...
String interpolation https://github.com/icy-arctic-fox/spectator/issues/41
2022-01-10 21:30:55 -07:00
Michael Miller
07aa968d68
Report failed expectation line
...
In output listing the failures, the comment line now shows the failed expectation line.
Previously this showed the example's source line.
2022-01-03 18:47:56 -07:00
Michael Miller
66e3155a0d
Bump version 0.10.3
2021-12-13 02:43:52 -07:00
Michael Miller
4d81031274
Fix usage of 'expect' outside test block
...
Previously gave weird runtime erorr about mismatched groups.
Now correctly produces a compilation error.
2021-12-13 02:42:02 -07:00
Michael Miller
315a318d7d
Explicit "provided" block description
...
Implements https://gitlab.com/arctic-fox/spectator/-/issues/69
2021-12-01 19:11:36 -07:00
Michael Miller
bc61e0e64f
Release 0.10.2
2021-10-22 17:43:33 -06:00
Michael Miller
f1f1659836
Fix adding stubs to class methods on mocked types
2021-10-11 23:03:50 -06:00
Michael Miller
5692a77a1b
Update naming from partial to target
2021-10-11 23:03:12 -06:00
Michael Miller
36354082c7
Pass arguments to original/fallback for stubbed top-level methods
...
Addresses https://github.com/icy-arctic-fox/spectator/issues/36
2021-09-28 19:02:42 -06:00
Michael Miller
a95c5bcab7
Better handling with be
match against Value types and nil
...
Releates to https://github.com/icy-arctic-fox/spectator/issues/37
2021-09-28 18:22:41 -06:00
Michael Miller
99ced17516
Handle undefined methods with have_attributes matcher
...
Instead of producing a compilation error on missing/undefind methods,
substitute in an "undefined" value.
This shows better output to the user.
2021-09-26 12:50:17 -06:00
Michael Miller
83fa0499d3
Fix https://github.com/icy-arctic-fox/spectator/issues/34
2021-09-22 18:01:15 -06:00
Michael Miller
e0e442d394
Fix release date of v0.10.0
2021-09-16 09:10:12 -06:00
Michael Miller
53bbd24617
Release 0.10.1
2021-09-16 09:04:44 -06:00
Michael Miller
a51640105c
Re-add pre- and post-condition hooks
...
Accidentally removed in hook refactoring.
Addresses https://gitlab.com/arctic-fox/spectator/-/issues/62
2021-09-16 09:01:51 -06:00