Michael Miller
12f3f35958
Merge remote-tracking branch 'GrantBirki/master'
...
PR: https://github.com/icy-arctic-fox/spectator/pull/57
2024-08-13 18:18:06 -06:00
Grant Birkinbine
73e1686219
fix: Error: expecting token 'CONST', not '::'
2024-08-11 15:28:19 -07:00
Michael Miller
287758e6af
Update README to point at v0.12.0
2024-02-03 08:05:02 -07:00
Michael Miller
f39ceb8eba
Release v0.12.0
2024-02-03 07:56:57 -07:00
Michael Miller
9b1d400ee1
Update CHANGELOG
2024-01-27 11:29:11 -07:00
Michael Miller
edb20e5b2f
Additional handling when comparing ranges against unexpected types
2024-01-27 11:25:59 -07:00
Michael Miller
526a998e41
Shorten compare_values case statements
2024-01-27 11:25:25 -07:00
Michael Miller
556d4783bf
Support case equality of tuples, arrays, named tuples, and hashes in stub argument matching
2024-01-27 11:18:10 -07:00
Michael Miller
b5fbc96195
Allow matchers to be used in case equality
2024-01-27 11:17:19 -07:00
Michael Miller
5520999b6d
Add spec for GitHub issue 55
...
https://github.com/icy-arctic-fox/spectator/issues/55
2024-01-27 11:16:57 -07:00
Michael Miller
4a630b1ebf
Bump version to v0.11.7
2023-10-16 17:34:49 -06:00
Michael Miller
d72895fe10
Merge branch 'stufro-fix-readme-mocking-example'
2023-05-21 09:58:19 -06:00
Stuart Frost
04f151fddf
Fix mocking example in README.md
2023-05-19 19:39:22 +01: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
Mike Miller
3852606b28
Merge branch 'gh-49' into 'master'
...
Fix splat argument expansion in method redefinition
See merge request arctic-fox/spectator!36
2023-01-27 00:28:42 +00: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
5c08427ca0
Add utility script to run nightly spec
2023-01-26 16:43:19 -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
528ad7257d
Disable GitHub issue 49 spec for now
2023-01-26 16:17:29 -07:00
Michael Miller
7149ef7df5
Revert "Compiler bug when using unsafe_as"
...
This reverts commit cb89589155
.
2023-01-26 16:12:54 -07:00
Michael Miller
cb89589155
Compiler bug when using unsafe_as
2023-01-25 16:09:16 -07:00
Michael Miller
a5e8f11e11
Store type to reduce a bit of bloat
2023-01-23 16:02:30 -07:00
Michael Miller
abbd6ffd71
Fix splat argument expansion in method redefinition
...
The constructed previous_def call was malformed for stub methods.
Resolves the original issue in
https://github.com/icy-arctic-fox/spectator/issues/49
2023-01-23 11:55:52 -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
6a5e5b8f7a
Catch errors while evaluating node labels
2022-12-20 21:40:47 -07:00
Michael Miller
4a0bfc1cb2
Add smoke tag
2022-12-20 20:52:01 -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
30602663fe
Add tests for interpolated labels
...
The context label test intentionally fails.
This functionality still needs to be implemented.
2022-12-20 20:12:58 -07:00
Michael Miller
b8901f522a
Remove unnecessary cast
2022-12-20 20:11:09 -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
7620f58fb8
Test file, please ignore
2022-12-19 02:31:12 -07:00
Michael Miller
feaf1c6015
Bump version to 0.11.5
2022-12-18 19:15:25 -07:00
Michael Miller
8f80b10fc1
Support injecting mock functionality into modules
...
Add mock registry for a single module.
2022-12-18 19:04:50 -07:00
Michael Miller
a3c55dfa47
Add tests for module mocks docs
2022-12-18 18:52:08 -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
d378583054
Support mocking modules
2022-12-18 15:18:20 -07:00
Michael Miller
6255cc85c4
Handle original call reaching to another type
...
Primary use case for this is mock modules.
Allows default stubs to access more than previous_def and super.
2022-12-18 15:17:48 -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
f55c60e01f
Fix README spec
...
Mocked types cannot be private.
Moved to a module to prevent polluting the global namespace.
2022-12-17 21:01:22 -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
c3e7edc700
Use absolute names of types in mocked type methods
...
Prevent possibly type name collisions.
This could happen if, for instance, Array or String was redefined in the scope of the mocked type.
2022-12-17 20:37:27 -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
65a4b8e756
Populate previous_def/super with captured block args
...
The previous_def and super keywords do not propagate blocks.
See: https://github.com/crystal-lang/crystal/issues/10399
This works around the issue by populating arguments if the method uses a block.
2022-12-17 16:41:22 -07:00