Commit graph

493 commits

Author SHA1 Message Date
Michael Miller
0ea7890ece
Merge branch 'master' into mock-redesign 2022-02-28 20:39:33 -07:00
Michael Miller
92e839415d
Fix sample iteration with single block arg (not tuple) 2022-01-26 13:14:30 -07:00
Michael Miller
d6112bd2dd
Rip out mocks 2022-01-26 12:41:41 -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
dd49fe3a67
Support string interpolation for example names 2022-01-10 21:29:05 -07:00
Michael Miller
aabec269cb
Raise compilation error for string interpolation in group name 2022-01-10 21:11:28 -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
d9269e17a8
Better implementation of explicit subject 2021-12-02 01:57:34 -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
59ce312341
Fix typos and spelling 2021-11-28 15:45:17 -07:00
Michael Miller
627a288358
Missing doc 2021-09-20 11:01:00 -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
Michael Miller
c49522a791
Allow tags on top-level groups 2021-08-18 15:57:22 -06:00
Michael Miller
21d14bd814
Add f-prefix variants of groups and examples
For instance: `fit` for `it "...", :focus`
2021-08-18 13:55:21 -06:00
Michael Miller
65799fdd3b
Pass along end line 2021-08-17 13:49:58 -06:00
Michael Miller
0f7a9ed9e8
Remove append and prepend variants of hook definition methods
RSpec defines these as applying to a scope (example, context, suite) as 
opposed to example group.
Mimicing this is currently not possible in Spectator and would require a 
substantial restructure of how hooks are handled.
This may be implemented in the future.
2021-08-08 11:50:30 -06:00
Michael Miller
91d21b38e2
Lazily initialize global DSL spec builder
Require config to create a spec builder.
Config should be fully set up before any DSL is encountered.
2021-08-08 11:25:06 -06:00
Michael Miller
605b82c532
Add prepend and append variants of hooks to DSL 2021-08-08 10:51:39 -06:00
Michael Miller
abe78410c4
Formatting 2021-07-31 14:18:59 -06:00
Michael Miller
868aa1d00a
Support custom handling of hooks 2021-07-31 14:16:39 -06:00
Michael Miller
f53ffabf6b
Support label for aggregate_failures block 2021-07-31 12:04:43 -06:00
Michael Miller
4c125d98d4
Implement aggregate_failures 2021-07-31 11:56:53 -06:00
Michael Miller
9a97596b84
Allow named arguments in provided block 2021-07-31 10:15:16 -06:00
Michael Miller
6c6dff363b
Track source location of pending result 2021-07-17 16:25:32 -06:00
Michael Miller
a810eef16c
Add before_suite and after_suite 2021-07-17 14:19:16 -06:00
Michael Miller
571bc7d8a5
Reuse iterative example group macro code
Add support for x prefix to skip sample and random_sample groups.
2021-07-17 13:25:38 -06:00
Michael Miller
e506c6b981
Implement random_sample 2021-07-17 13:05:03 -06:00
Michael Miller
9d72d26630
Handle sample count 2021-07-17 12:49:11 -06:00
Michael Miller
76a23131cb
More checks for missing block in DSL
Improved some error messages.
2021-07-17 12:36:21 -06:00
Michael Miller
640857bef2
Pretty up iterative group names 2021-07-17 12:15:41 -06:00
Michael Miller
d8e9d3128a
Fetch iteration item from group 2021-07-17 12:07:04 -06:00
Michael Miller
aa12cdf17c
Introduce non-expectation error ExampleFailed
Used by fail method.
Still todo: Output from failed example is missing because there are no 
expectations.
2021-07-10 03:32:55 -06:00
Michael Miller
3e4079d408
Remove Spec namespace 2021-07-05 11:49:16 -06:00
Michael Miller
6a01ab3531
Merge master into release/0.10 2021-07-05 11:32:45 -06:00
Michael Miller
989f53c6d6
Initial code for sample groups 2021-06-19 11:57:56 -06:00
Michael Miller
44ade24fb7
Generate context one or more times
This is necessary for iterative (sample) groups so they don't share a 
context.
2021-06-19 11:33:26 -06:00
Michael Miller
4b8d28c916
Wording on compiler error for block args 2021-06-19 10:54:31 -06:00
Michael Miller
4ff27defff
Initial code for iterative (sample) groups 2021-06-13 13:16:31 -06:00
Michael Miller
e51ad6d504
Check if provided and given are used in a method 2021-06-12 17:06:43 -06:00
Michael Miller
04d6c70f59
Cleaner distinction between metadata and tags 2021-06-12 16:45:45 -06:00
Michael Miller
704c28e822
Reimplement given as provided and deprecate
The behavior is slightly different now.
Nested example blocks aren't allowed in `provided`.
The block produces one example, not multiple.
2021-06-12 16:23:38 -06:00
Michael Miller
71a5c39f6c
Use skip instead of pending tag
Specify default reason for skipping groups.
2021-06-12 12:14:19 -06:00
Michael Miller
2407c43132
Only show "Not yet implemented" for missing test block 2021-06-12 09:53:42 -06:00
Michael Miller
bfbeaf7454
Default reason for missing example block "Not yet implemented" 2021-06-11 21:16:46 -06:00
Michael Miller
6f4cc12dfd
Mark example pending if block is omitted 2021-06-11 21:03:46 -06:00
Michael Miller
117ed90185
Fix DSL usage of tags
Ensure parent tags don't get modified by duplicating the hash.
Force tag value to string.
2021-06-11 20:22:08 -06:00
Michael Miller
14d45756e9
Consolidate default pending reason 2021-06-11 18:59:10 -06:00
Michael Miller
4f2df78c34
Deprecate current behavior of pending blocks 2021-06-11 18:55:56 -06:00
Michael Miller
4a9ec3df4a
Store tags with an optional string value 2021-06-11 18:26:55 -06:00
Michael Miller
d9088b39ca
Add skip message when using xit (and variants) 2021-06-11 18:11:46 -06:00
Michael Miller
8d73434e0b
Add ability to mark example skipped/pending mid-test 2021-06-09 21:57:17 -06:00
Michael Miller
a08d5202fe
Implement pending examples as lighweight examples
Drop test code block if a pending, skip, or x-prefix macro is used.
2021-06-05 12:51:46 -06:00
Michael Miller
6bea36d8b6
Move Node out of Spec namespace 2021-05-07 20:09:33 -06:00
Michael Miller
f24d634ccb
Merge branch 'release/0.10' into specs 2021-04-26 17:19:25 -06:00
Michael Miller
29594eefab
Merge branch 'master' into release/0.10 2021-04-26 11:19:08 -06:00
Michael Miller
93e270f87a
Support variables and methods for type matcher (be_a).
Addresses https://github.com/icy-arctic-fox/spectator/issues/25
2021-04-17 09:38:29 -06:00
Michael Miller
d612657b15
Merge branch 'release/0.10' into specs 2021-03-31 15:28:16 -06:00
Michael Miller
3d702f9bc6
Merge branch 'master' into release/0.10 2021-03-31 15:19:30 -06:00
matthewmcgarvey
8fafd2467d Allow matching any line number of example in filter 2021-03-30 00:18:08 -04:00
Michael Miller
74b78b7ca8
Rename Source to Location 2021-02-12 22:46:22 -07:00
Michael Miller
08451df643
Add matcher to check compiled type of values 2021-02-12 18:33:50 -07:00
Michael Miller
3083f82132
Change DSL::Values to DSL::Memoize 2021-02-10 17:07:49 -07:00
Michael Miller
3cd569e639
Prevent using reserved keywords in let and subject 2021-02-10 16:58:17 -07:00
Michael Miller
8232da1167
Mark DSL generated methods as private 2021-02-09 22:40:15 -07:00
Michael Miller
8d48e441b2
Fix generating source from brace-less examples.
Addresses https://github.com/icy-arctic-fox/spectator/issues/20
2021-02-03 10:06:00 -07:00
Michael Miller
0363c43dff
Fix described_class
Must be a macro, otherwise the return type becomes a union of all nested 
described_class methods, which can cause weird errors.
2021-01-31 00:38:17 -07:00
Michael Miller
e275711f2b
Formatting 2021-01-30 23:48:59 -07:00
Michael Miller
078058ad05
Fix various issues with subjects
All tests in crystal spec pass!
2021-01-30 20:38:09 -07:00
Michael Miller
e8b284fc60
Fix namepsaces
crystal spec compiles again!
2021-01-30 17:40:33 -07:00
Michael Miller
d3ad0963cd
Minor fixes 2021-01-30 17:31:50 -07:00
Michael Miller
73985772b7
DSL fully added back in 2021-01-30 16:43:13 -07:00
Michael Miller
20680f37cb
Add docs 2021-01-30 15:39:29 -07:00
Michael Miller
ba967218fa
Move tags code to a common location 2021-01-30 15:34:17 -07:00
Michael Miller
bd942bb644
Shorten tag method names
Plain `tags` is safe to use as a class method on the group.
2021-01-30 14:13:27 -07:00
Michael Miller
e093ec788e
Clean up tags method generation by moving it to another macro 2021-01-30 14:08:42 -07:00
Michael Miller
803a09464d
Initial work to pass along pre-set tags
Define pending examples and groups using this method.
2021-01-30 12:32:13 -07:00
Michael Miller
de779fdf61
Remove unecessary type name 2021-01-30 12:26:29 -07:00
Michael Miller
db877da984
Change tags to symbols 2021-01-30 12:03:38 -07:00
Michael Miller
5166cd7778
Fix case with no tags and some metadata
Simplify tag set construction code.
2021-01-30 12:01:49 -07:00
Michael Miller
467f0d3ad4
Pass along tags 2021-01-30 11:34:01 -07:00
Michael Miller
e77d6f0a4f
Change groups from metadata to tags 2021-01-30 11:21:49 -07:00
Michael Miller
8cf498c9e9
Switch to using tags instead of metadata 2021-01-30 11:13:30 -07:00
Michael Miller
a56b1e0eb1
Somewhat functional metadata unwrap 2021-01-30 01:16:26 -07:00
Michael Miller
466a388558
Initial code for example metadata 2021-01-30 00:40:59 -07:00
Michael Miller
5cccf5b4cb
Support example as block argument to let and subject
Surprisingly, RSpec supports this.
https://relishapp.com/rspec/rspec-core/v/3-10/docs/metadata/current-example
2021-01-22 23:00:17 -07:00
Michael Miller
b7ed4ec14c
Nest spec types 2021-01-21 00:03:39 -07:00
Michael Miller
ce6f77656a
Use ExpectationFailed instead of AssertionFailed 2021-01-20 21:38:34 -07:00
Michael Miller
98a29309ff
Remove assert methods 2021-01-20 21:36:18 -07:00
Michael Miller
153933b044
Add DSL and code to create around_each hooks 2021-01-16 16:47:40 -07:00
Michael Miller
4500ebcddc
Update old references to Value and Block 2021-01-16 11:02:29 -07:00
Michael Miller
e09f5c960a
Change Assertions to Expectations
Start expectation rework.
2021-01-16 10:22:23 -07:00
Michael Miller
a74957204b
Introduce abstract generic value type
Sits between AbstractExpression and Value and Block.
2021-01-15 22:32:02 -07:00
Michael Miller
4ed8c4a573
Implement remaining assertion macros
Move "should" methods.
2021-01-10 11:09:28 -07:00
Michael Miller
096c31d7f5
Initial work on assertions 2021-01-09 19:50:32 -07:00
Michael Miller
122395837f
Implement remaining value DSL macros 2021-01-09 17:36:50 -07:00
Michael Miller
391325d431
Initial work on values DSL 2021-01-09 17:01:33 -07:00
Michael Miller
7451769a29
Pass current example as block argument 2021-01-09 13:34:15 -07:00
Michael Miller
009ca4776a
Cleanup new DSL macros 2021-01-09 13:17:42 -07:00
Michael Miller
df096d91aa
Capture source info for hooks 2021-01-09 11:30:00 -07:00
Michael Miller
2ecd4ded6d
Fix line numbers being wrong with macro expansion
Addresses https://github.com/icy-arctic-fox/spectator/issues/18
2021-01-08 15:32:15 -07:00