Michael Miller
0067191423
Remove reference to Internals namespace
2019-09-26 15:11:36 -06:00
Michael Miller
1f300a4a18
Use label in sub-group name
2019-09-26 15:05:28 -06:00
Michael Miller
c3ea34e762
Retrieve test value for sample group
2019-09-26 14:57:31 -06:00
Michael Miller
f6e95719ad
Remove unnecessary quotes in example name
2019-09-26 14:08:17 -06:00
Michael Miller
e5bd582f5f
Handle collection for sample group
2019-09-26 14:05:55 -06:00
Michael Miller
cd0ba81417
Pass test values to test instance
2019-09-26 13:00:23 -06:00
Michael Miller
3c9846ae9b
Remove reference to internals
2019-09-26 12:59:42 -06:00
Michael Miller
5d9e7002d6
Some initial work on sample groups
2019-09-26 12:31:23 -06:00
Michael Miller
422c805e21
Rename SampleValues to TestValues
...
Move out of internal namespace.
2019-09-26 10:26:37 -06:00
Michael Miller
73cef75fcb
Remove dummy example
2019-09-26 09:56:54 -06:00
Michael Miller
a355b59f3e
Type annotations for return types
2019-09-25 09:12:03 -06:00
Michael Miller
d4e890af4c
Merge remote-tracking branch 'origin/master' into example-restructure
2019-09-23 21:30:12 -06:00
Michael Miller
3a6fcb9b0d
Fix value negation of attribute matcher
2019-09-23 20:52:03 -06:00
Michael Miller
00d1cd9ea3
Address warnings with return types in generated types
2019-09-23 20:42:04 -06:00
Michael Miller
43dc106c18
Add return type annotations
...
Addresses Crystal compiler warning about abstract method return types.
2019-09-23 20:32:21 -06:00
Michael Miller
adbfb7da7c
Use integer division - Crystal 0.31.0 change
2019-09-23 19:38:15 -06:00
Michael Miller
24ccb77595
Expose running example to before-each and after-each hooks
2019-09-22 11:27:18 -06:00
Michael Miller
5f3c9d2f63
Distinguish group variables
2019-09-22 11:02:53 -06:00
Michael Miller
24eb5e419a
Get around_each hooks working again
2019-09-18 21:51:35 -06:00
Michael Miller
b17d19689e
Formatting
2019-09-18 09:52:49 -06:00
Michael Miller
db3f89731c
Call parent hooks
2019-09-18 09:51:45 -06:00
Michael Miller
957b8a54db
Implement before and after hooks
2019-09-17 20:58:26 -06:00
Michael Miller
6e1605f246
Add TestContext
2019-09-17 20:57:59 -06:00
Michael Miller
da8736f891
Don't create test as part of run method
2019-09-17 20:37:06 -06:00
Michael Miller
9129aa4286
Use Deque instead of Array
2019-09-17 20:35:19 -06:00
Michael Miller
52ef5e5ced
Some DSL methods for hooks
2019-09-15 10:40:53 -06:00
Michael Miller
7002564ebd
Add let and subject with variants
...
New behavior mimics RSpec - bang variant defines immediately instead of
not storing.
2019-09-15 09:45:48 -06:00
Michael Miller
c94b284ab3
Replace large DSL files with smaller, logical groups
2019-09-15 09:15:33 -06:00
Michael Miller
3f7c16c888
Move all DSL to one module, but separate files
2019-09-13 14:33:46 -06:00
Michael Miller
fafe5606e6
Rename DSL::Builder to SpecBuilder
...
Place all builders under SpecBuilder.
2019-09-13 14:10:25 -06:00
Michael Miller
5d86b4f50e
Get examples working again
2019-09-12 20:26:54 -06:00
Michael Miller
08ee03b1de
Quickly get things somewhat working again
2019-09-12 20:16:41 -06:00
Michael Miller
64166d1c36
Some fixes
2019-09-11 22:21:06 -06:00
Michael Miller
a100191875
Merge branch 'example-restructure' of gitlab.com:arctic-fox/spectator into example-restructure
2019-09-08 11:02:02 -06:00
Michael Miller
a178db05ac
Use TestWrapper in Example classes
2019-09-08 10:38:26 -06:00
Michael Miller
de8f298676
Remove hooks, conditions, and sample vlues (for now)
...
Removed only from examples and example groups.
2019-09-08 10:28:02 -06:00
Michael Miller
e304224bd6
Move stack handling to its own type
2019-09-08 09:59:25 -06:00
Michael Miller
f25eb9164f
Some test creation rewrite
2019-09-08 09:58:15 -06:00
Michael Miller
0706a9986c
Ensure example is set to finished after running
2019-09-06 13:08:41 -06:00
Michael Miller
1c5b46b981
Use fresh variables
2019-09-01 00:54:04 -06:00
Michael Miller
19913a28d1
Gut factories and example structure code
2019-08-31 13:12:40 -06:00
Michael Miller
b8e125e38f
Add test wrapper
2019-08-31 13:12:17 -06:00
Michael Miller
00a2495027
Change test root to SpectatorTest
2019-08-31 13:11:59 -06:00
Michael Miller
752b7f0ffa
Update version constant
2019-08-31 10:14:06 -06:00
Michael Miller
bfe641e07e
Move sample values to group instance
...
The goal is to construct examples with a parameterless initializer.
This doesn't quite work, since the sample values are retrieved via the
harness, which doesn't have an active example when the sample values are
created.
2019-08-30 14:46:24 -06:00
Michael Miller
4ecc2c6004
Include ExampleDSL at root
...
Will need to check if methods can run in that scope.
2019-08-30 13:14:48 -06:00
Michael Miller
64045171c2
Change contexts from modules to classes
2019-08-30 12:39:03 -06:00
Michael Miller
6e9633d001
Hacked in double instance creation
2019-08-26 22:48:15 -06:00
Michael Miller
3462bdea1a
Some initial double code
2019-08-26 21:49:47 -06:00
Michael Miller
70e01364ce
Address Ameba issue
2019-08-26 21:11:21 -06:00
Michael Miller
4abf97139b
Experimenting with auto-mocking methods
2019-08-26 21:06:06 -06:00
Michael Miller
a75ab04dd5
Update version to 0.8.2
2019-08-21 19:28:17 -06:00
Michael Miller
325af1f24e
Workaround for Crystal issue
...
Fix for GitHub issue 1 -
https://github.com/icy-arctic-fox/spectator/issues/1
Works around Crystal issue 7060 (6920) -
https://github.com/crystal-lang/crystal/issues/7060
This should be reverted after it is fixed in the Crystal compiler.
2019-08-21 19:26:40 -06:00
Michael Miller
c36859b42b
Correct docs
2019-08-17 08:10:26 -06:00
Michael Miller
7f58c52e43
Cleanup
2019-08-17 08:05:05 -06:00
Michael Miller
498635d288
Pass along a proc to generate the array
...
The "to_a" method is actually dynamically generated.
2019-08-17 08:00:16 -06:00
Michael Miller
43440d37b0
Explicit initializer with sample values
...
Not sure why it isn't getting the one from the module.
2019-08-17 07:59:32 -06:00
Michael Miller
a59e38155e
Defer collection evaluation until build
2019-08-17 07:51:29 -06:00
Michael Miller
34b5487e6f
Pass along class type instead of collection
2019-08-15 17:38:54 -06:00
Michael Miller
01c4b78716
Move placeholder initializer up a level
2019-08-15 16:43:25 -06:00
Michael Miller
b026668de2
Formatting
2019-08-12 14:17:23 -06:00
Michael Miller
46c775932a
Negated all match is not supported
2019-08-12 14:17:04 -06:00
Michael Miller
0cb77b3355
Add all-matcher to DSL
2019-08-12 14:07:13 -06:00
Michael Miller
8520697efa
Initial code for all-matcher
2019-08-12 14:05:14 -06:00
Michael Miller
4e15487a0f
Add relative change matcher
2019-08-11 23:08:45 -06:00
Michael Miller
c19f442e6c
Add #by modifier methods
2019-08-11 13:52:22 -06:00
Michael Miller
848f80ddf8
Add block short-hand syntax support to change matcher
2019-08-11 13:16:40 -06:00
Michael Miller
2666f80653
Hackish fix for block short-hand syntax
...
Dunno when this broke or how it ever worked. 😐
2019-08-11 13:16:18 -06:00
Michael Miller
27436b4e09
Need to use fresh variables in this macro
2019-08-11 12:55:38 -06:00
Michael Miller
5dfcad3cb4
Flip operands of != in case expected has custom logic
2019-08-11 12:40:27 -06:00
Michael Miller
e1a119639f
Add change exact matcher
2019-08-11 12:39:33 -06:00
Michael Miller
3c539b3517
Fix require statements
2019-08-10 12:54:46 -06:00
Michael Miller
1d205b6ee9
Put test expression on its own line
2019-08-10 12:49:54 -06:00
Michael Miller
214b2e171e
Refactor existing change matchers to use new format
2019-08-10 12:42:57 -06:00
Michael Miller
a56d6762c0
Formatting
2019-08-10 11:38:13 -06:00
Michael Miller
535dc6e923
Add change.to variant
2019-08-10 11:37:19 -06:00
Michael Miller
59cf939536
Don't store initial value in matcher
2019-08-10 11:37:19 -06:00
Michael Miller
770100891c
Add change.from variant
2019-08-10 11:36:38 -06:00
Michael Miller
946604b737
Add tests for override cases
...
Fix negated? method.
2019-08-10 11:34:16 -06:00
Michael Miller
24066c46a0
Allow MatchData to control whether they can be negated
...
Values are still negated, but message and matching status are not.
2019-08-10 11:27:15 -06:00
Michael Miller
3e1ee7eb6d
Initial code for basic change matcher
2019-08-10 11:21:14 -06: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
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
Michael Miller
ab147d00fb
Cleanup match methods
2019-08-06 22:18:05 -06:00
Michael Miller
13fad5081b
Initial refactor of ArrayMatcher
2019-08-06 21:56:33 -06:00
Michael Miller
044202e606
Use inspect instead of to_s for value reporting
2019-08-06 21:55:22 -06:00
Michael Miller
5cc735368c
Update comparison matchers
2019-08-01 21:17:24 -06:00
Michael Miller
42b8fe471f
Fix some includes and a dangling old file
2019-08-01 16:37:19 -06:00
Michael Miller
11600a2f8d
Simplify more matchers that are easy targets
2019-08-01 16:35:02 -06:00
Michael Miller
16a2204a2d
Simplify CaseMatcher by using new matcher refactoring
2019-08-01 16:17:39 -06:00
Michael Miller
c75fba8076
Change visibility to private
2019-08-01 16:17:12 -06:00
Michael Miller
4b59dcf142
Pass actual value to failure message methods and values
2019-08-01 16:02:28 -06:00
Michael Miller
f63697b019
Update ValueMatcher to use Matcher's methods
2019-08-01 15:59:29 -06:00
Michael Miller
114a4077f3
Fix parameters on LabeledValue
2019-08-01 15:58:48 -06:00
Michael Miller
f004912fc1
Value first, then label
2019-08-01 15:48:39 -06:00
Michael Miller
7e3b3cd999
Fix namespaces
2019-08-01 15:44:04 -06:00
Michael Miller
99d8f2a845
Use TestValue instead of custom LabeledValue
2019-08-01 15:40:46 -06:00
Michael Miller
763a65beac
Rename again
...
This naming is more appropriate since these types can be used for
expected and actual values.
2019-08-01 15:38:20 -06:00
Michael Miller
dd69cec536
Should capture a block instead of a value
2019-08-01 15:22:45 -06:00
Michael Miller
28680fa849
Rename Actual types to be more "human" sounding
2019-08-01 15:22:18 -06:00
Michael Miller
79a095bb31
Use new style expectations and actuals in DSL
2019-08-01 15:00:56 -06:00
Michael Miller
96c271cf33
No need to shout
2019-08-01 14:46:47 -06:00
Michael Miller
ba1c37b142
Fix macro
2019-08-01 14:46:13 -06:00
Michael Miller
10cf7bbb77
Update Expectation to use new MatchData
2019-08-01 14:05:27 -06:00
Michael Miller
96f2888b88
Fully implement match methods
...
Add placeholders for matcher values.
2019-08-01 14:05:05 -06:00
Michael Miller
acd01a23e6
Re-add MatchData and variants
2019-08-01 14:04:00 -06:00