Commit graph

943 commits

Author SHA1 Message Date
Michael Miller
3e1ee7eb6d Initial code for basic change matcher 2019-08-10 11:21:14 -06:00
Mike Miller
1521107934 Merge branch 'matcher-refactor' into 'release/0.8'
Matcher refactor

See merge request arctic-fox/spectator!13
2019-08-10 17:14:10 +00:00
Michael Miller
ede691dd6a Reorder methods to be in a more standard layout 2019-08-10 11:10:48 -06:00
Michael Miller
898ddcb616 Type annotations for #match? 2019-08-10 10:55:22 -06:00
Michael Miller
c4b886cad2 Add match data docs 2019-08-10 10:53:00 -06:00
Michael Miller
d5fd21702a Add matcher docs 2019-08-10 10:50:48 -06:00
Michael Miller
37c8dd0865 Stringify respond_to bools 2019-08-10 09:55:26 -06:00
Michael Miller
39f253952d Add docs and some more type annotations 2019-08-09 17:26:53 -06:00
Michael Miller
db4eaca291 Just assert the return value isn't nil 2019-08-09 17:21:12 -06:00
Michael Miller
efd0ab089d Define type annotations for match methods
Hopefully this speeds up some compilation.
2019-08-09 16:58:35 -06:00
Michael Miller
a54e406fec Clean up expectation specs
Removed tests that are no longer valid or non-trivial to update.
2019-08-09 15:32:22 -06:00
Michael Miller
251e3b8774 Remove specs for matchers
Will replace with Spectator-based tests later.
2019-08-09 15:16:01 -06:00
Michael Miller
85b7412436 Fix some more matcher errors 2019-08-09 15:14:00 -06:00
Michael Miller
8fc3af075c Workaround for NoReturn type for block
Not sure if this will work for everything.
It seems that NoReturn shows up as ReturnType (generic) when the
compiler detects the block will raise.
2019-08-09 15:06:22 -06:00
Michael Miller
c47b47ade9 Fix most problems (hopefully) with ExceptionMatcher 2019-08-09 14:18:59 -06:00
Michael Miller
2251168631 Get inspection string of attribute values 2019-08-09 14:01:10 -06:00
Michael Miller
751c15434b Help infer the block's return type 2019-08-09 11:29:53 -06:00
Michael Miller
e763296c26 Remove inspection quotes from around output values 2019-08-09 11:23:10 -06:00
Michael Miller
0dfde61807 Fix method name matches? -> match? 2019-08-09 11:20:41 -06:00
Michael Miller
5a1dea8f72 Convert bools to strings for output 2019-08-09 11:20:29 -06:00
Michael Miller
3d86893f44 Resolve various duck-typing issues 2019-08-09 11:13:13 -06:00
Michael Miller
114bfa47c2 Genericize TestExpression and make value abstract
This seems to resolve issues with the compiler making unions of
unrelated test case types.
2019-08-09 11:12:15 -06:00
Michael Miller
569faa0a2b Various other fixes 2019-08-09 00:42:39 -06:00
Michael Miller
8b718f0bd0 Handle union case for expected value
When using both forms of the HaveMatcher - expected can be a Char,
String, or Regex. Regex is invalid for String#includes?.
I believe this might be a generics issue that was fixed recently in
Crystal.
2019-08-09 00:32:45 -06:00
Michael Miller
353e5f6886 Update formatting to use Tuple 2019-08-08 21:57:02 -06:00
Michael Miller
9dc5a999d1 Fix method name (copy/paste fail) 2019-08-08 21:52:33 -06:00
Michael Miller
3b1a5a1121 Fix various expectation type code 2019-08-08 21:52:05 -06:00
Michael Miller
21e10c1ef2 Fix expected value snapshot 2019-08-08 21:39:30 -06:00
Michael Miller
955311bb95 Don't force Enumerable expected type
Should duck type anyway.
2019-08-08 21:38:49 -06:00
Michael Miller
eef7e9ce3c Wrap expression and label in TestValue 2019-08-08 17:15:13 -06:00
Michael Miller
4665d5f68d Fix inconsistent naming for test expressions 2019-08-08 17:08:38 -06:00
Michael Miller
2eb51b9c41 Fix type inference in TestValue 2019-08-08 17:05:44 -06:00
Michael Miller
1222e24836 Add missing methods to matchers
Fix matcher inheritance.
2019-08-08 17:03:47 -06:00
Michael Miller
9bffb30041 Refactor UnorderedArrayMatcher 2019-08-08 16:59:29 -06:00
Michael Miller
3ae16c6ec1 Refactor predicate and respond matchers
Add missing match? method to AttributesMatcher.
2019-08-08 16:47:27 -06:00
Michael Miller
520c738f6a Refactor RangeMatcher 2019-08-08 16:47:17 -06:00
Michael Miller
cbaa9a4c43 Refactor StartWithMatcher 2019-08-08 16:04:09 -06:00
Michael Miller
a3fa522bd4 Refactor TruthyMatcher 2019-08-08 15:59:31 -06:00
Michael Miller
badccad2fa Some more easy target refactors
EmptyMatcher should extend StandardMatcher.
2019-08-08 15:45:34 -06:00
Michael Miller
17aa472d92 Refactor HaveMatcher 2019-08-08 15:26:30 -06:00
Michael Miller
f1ebce7739 Refactor HaveKeyMatcher and HaveValueMatcher 2019-08-08 15:25:32 -06:00
Michael Miller
7cca43029e Refactor ExceptionMatcher 2019-08-08 14:20:21 -06:00
Michael Miller
72e5735106 Refactor EndWithMatcher 2019-08-07 00:08:32 -06:00
Michael Miller
f2f46418a3 Refactor collection matcher 2019-08-07 00:07:39 -06:00
Michael Miller
ec96bf2de2 Refactor AttributesMatcher to use new style 2019-08-06 23:35:36 -06:00
Michael Miller
6a317b7a21 Re-add ordering methods 2019-08-06 23:22:50 -06:00
Michael Miller
3314ce8579 Remove ExpectedActual utility class
Don't think this is needed anymore.
2019-08-06 23:21:08 -06:00
Michael Miller
98b2cbc9cb Fix type inference 2019-08-06 23:20:23 -06:00
Michael Miller
436c10cad6 Simplify match data values by using named tuples 2019-08-06 23:13:33 -06:00
Michael Miller
e7b19ee591 Insert StandardMatcher into Matcher hierarchy
This is to remove all the unused abstract methods.
2019-08-06 22:33:13 -06:00