Michael Miller
4a630b1ebf
Bump version to v0.11.7
2023-10-16 17:34:49 -06:00
Michael Miller
9cbb5d2cf7
Workaround issue using Box with union
...
Addresses issue found relating to https://gitlab.com/arctic-fox/spectator/-/issues/81
See https://github.com/crystal-lang/crystal/issues/11839
2023-03-27 18:37:50 -06:00
Michael Miller
726a2e1515
Add non-captured block argument
...
Preparing for Crystal 1.8.0
https://github.com/crystal-lang/crystal/issues/8764
2023-01-26 17:19:31 -07:00
Michael Miller
735122a94b
Bump v0.11.6
2023-01-26 16:21:33 -07:00
Michael Miller
9ea5c261b1
Add entry for GitHub issue 49
...
https://github.com/icy-arctic-fox/spectator/issues/49
2023-01-26 16:19:55 -07:00
Michael Miller
24a860ea11
Add reference to new issue
...
https://github.com/icy-arctic-fox/spectator/issues/51
2023-01-26 16:18:26 -07:00
Michael Miller
fd372226ab
Revert "Use separate context for example name interpolation"
...
This reverts commit d46698d81a
.
2022-12-21 18:51:09 -07:00
Michael Miller
d46698d81a
Use separate context for example name interpolation
...
This simplifies some code.
2022-12-20 20:43:47 -07:00
Michael Miller
8c3900adcb
Add support for interpolation in context names
2022-12-20 20:32:40 -07:00
Michael Miller
c4bcf54b98
Support casting types with should statements
2022-12-19 22:40:55 -07:00
Michael Miller
acf810553a
Use location of the 'should' keyword for their expectation
2022-12-19 22:27:58 -07:00
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