Michael Miller
cf7d67c972
Simplify ExampleIterator and remove unecessary allocations
2021-08-17 12:55:22 -06:00
Michael Miller
837e4cb85d
Implement Indexable(Node) on ExampleGroup
2021-08-17 12:54:36 -06:00
Michael Miller
4e5a52215a
Simplify
2021-08-16 20:27:27 -06:00
Michael Miller
3803d4582c
Use Iterable(Node) instead of ExampleGroup
2021-08-16 20:27:21 -06:00
Michael Miller
aa81f1d948
Change ExampleFilter to a NodeFilter
...
Node filters may operate on example groups as well as examples.
2021-08-08 12:13:59 -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
841efc236d
Fix flipped append/prepend of "after" hooks
2021-08-08 10:27:34 -06:00
Michael Miller
b9f0a31a4a
Overhaul hooks
...
Mostly cleanup and make managing hooks simpler, hopefully.
Tests indicate this configuration matches hook execution order of RSpec.
2021-08-07 21:45:49 -06:00
Michael Miller
10b652f4b5
Remove unique/temp names
2021-07-31 19:11:51 -06:00
Michael Miller
3dc3b88dbe
Add "after" hooks in reverse order to match RSpec
2021-07-31 15:48:54 -06:00
Michael Miller
edcb5118e6
Show pending count only if there are pending examples
2021-07-31 15:02:21 -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
ef1832721c
Remove unecessary branch
2021-07-20 18:29:26 -06:00
Michael Miller
e8413db33f
Support custom messages for failed expectations
...
Fixes https://gitlab.com/arctic-fox/spectator/-/issues/28
2021-07-17 17:42:25 -06:00
Michael Miller
0c4379c731
Formatting
2021-07-17 16:55:43 -06:00
Michael Miller
e60cc2a447
Phrasing
2021-07-17 16:41:49 -06:00
Michael Miller
eda4328a92
Blank line after stack trace
2021-07-17 16:35:35 -06:00
Michael Miller
52a0ae938a
Consistency with location and location?
2021-07-17 16:34:15 -06:00
Michael Miller
e316dd8a11
Fix missing example location in output
2021-07-17 16:27:38 -06:00
Michael Miller
6c6dff363b
Track source location of pending result
2021-07-17 16:25:32 -06:00
Michael Miller
7cb1545e83
Don't use failure location in failed example block output
...
This is problematic, since the failure could have ocurred outside the
example block (in a method call).
The comment line under the failure details will still point to the
result location, if it's available.
2021-07-17 16:15:11 -06:00
Michael Miller
81f1966417
Use location instead of source
2021-07-17 16:12:10 -06:00
Michael Miller
7e2b267e93
Use failure location in output if available
...
Fixes https://gitlab.com/arctic-fox/spectator/-/issues/57
2021-07-17 16:04:19 -06:00
Michael Miller
f75991f34c
Formatting
2021-07-17 15:21:15 -06:00
Michael Miller
937b084f66
Support defining hooks in configuration block
2021-07-17 15:20:58 -06:00
Michael Miller
009266c8c2
Fix naming of hook methods when using a block
2021-07-17 14:32:55 -06:00
Michael Miller
a810eef16c
Add before_suite
and after_suite
2021-07-17 14:19:16 -06:00
Michael Miller
af13a89257
Pass along fallback reason
2021-07-17 14:04:17 -06:00
Michael Miller
1b53607f8e
Cleanup and add docs
2021-07-17 14:01:27 -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
c79cb62a61
Quick implementation of iterative group builder
2021-07-17 12:06:53 -06:00
Michael Miller
c24c2cb5e1
Quick implementation of node builders
2021-07-17 11:10:44 -06:00
Michael Miller
c7a90b3e64
Shorten names and cleanup
2021-07-17 10:47:16 -06:00
Michael Miller
6c55301d0b
Merge remote-tracking branch 'origin/master' into release/0.10
2021-07-11 00:16:25 -06:00
Michael Miller
4d030fb85a
Fix no_args being passed incorrectly
2021-07-10 22:43:54 -06:00
Michael Miller
d9bb8e33fe
Fix finding stubs on types (static methods)
2021-07-10 22:41:10 -06:00
Michael Miller
23fd075d51
Add stub when using expect().to receive()
...
This appears to match RSpec's behavior.
2021-07-10 20:28:51 -06:00
Michael Miller
384fb3093f
Allow stubs returning nil to be used on NoReturn calls
2021-07-10 20:19:10 -06:00
Michael Miller
e47ae613a5
Check for and allow expected exits
2021-07-10 19:27:01 -06:00
Michael Miller
35cb0b527e
Use ExampleFailed instead of ExpectationFailed
2021-07-10 18:15:01 -06:00
Michael Miller
5f61a24656
Provide default stub for Process.exit
...
Prevent terminating the process from within a test.
2021-07-10 14:18:07 -06:00
Michael Miller
294bd61a25
Don't force top-level namespace
2021-07-10 14:17:14 -06:00
Michael Miller
b07e13aeb4
Remove custom handling of NoReturn
2021-07-10 13:57:23 -06:00
Michael Miller
a395e26bae
Revert "Fix methods not being stubbed with expect().to receive
syntax"
...
This reverts commit 1c865d1f4b
.
2021-07-10 13:21:21 -06:00
Michael Miller
06f9f380c9
Workaround for stubbing NoReturn method with Nil
...
Fixes spec/issues/github_issue_29_spec.cr:15
2021-07-10 12:54:09 -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
ccedcdac42
Use getter! macro
2021-07-10 03:31:22 -06:00
Michael Miller
82f26dbb91
Don't return nil for NoReturn stubs
...
Raise instead, which prevents making the method's return type nilable.
2021-07-08 11:36:07 -06:00
Michael Miller
aee5897922
Fix comma placement
2021-07-06 23:32:51 -06:00
Michael Miller
7081c168a5
Missing comma
2021-07-05 22:36:37 -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
92dbfc2a8e
Avoid calling NoReturn methods
2021-07-02 21:52:56 -06:00
Michael Miller
1c865d1f4b
Fix methods not being stubbed with expect().to receive
syntax
2021-07-02 21:45:16 -06:00
Michael Miller
83ab5f56f0
Use previous_def if method was defined in class
2021-07-02 21:01:41 -06:00
Michael Miller
a0537484f4
Allow creation of doubles without a definition
...
Utilizes anonymous doubles to implement this.
Fixes https://github.com/icy-arctic-fox/spectator/issues/30
2021-07-02 19:18:14 -06:00
Michael Miller
d4e2954725
Remove Nop checks
2021-07-02 18:56:24 -06:00
Michael Miller
e3f6fb3c7c
Add no_args support for stubs
...
Fixes https://github.com/icy-arctic-fox/spectator/issues/28
2021-07-02 18:43:39 -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
1f91836de1
Use block to create examples
...
Seems that nodes can't be duped/cloned easily.
2021-06-13 14:45:01 -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
02a4b2946e
Display failed expectations and error if an example had both
2021-06-12 12:10:44 -06:00
Michael Miller
621ddb466f
Support output of multiple failed expectations
2021-06-12 11:59:57 -06:00
Michael Miller
88f0c23a3e
Add support for sub-index in result blocks
2021-06-12 11:40:21 -06:00
Michael Miller
dcdb87e31a
Output match data to XML
2021-06-12 11:24:21 -06:00
Michael Miller
ba3a03736e
Show match data in failure block
2021-06-12 11:08:46 -06:00
Michael Miller
a5ed5d0fb1
Pass exception failure message to error
2021-06-12 10:33:28 -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
a061bd2044
Check pending, skip, and reason tags for reason
2021-06-11 19:29:29 -06:00
Michael Miller
12cba23fa3
Treat skip tag as pending
2021-06-11 19:03:16 -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
b43b09f46d
Change order of pending result parameters
2021-06-11 18:31:41 -06:00
Michael Miller
3b1db7b772
Pass along pending tag value if available
2021-06-11 18:30:12 -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
5a2a71ffe8
Pass and output along reason for pending/skip result
2021-06-09 22:15:15 -06:00
Michael Miller
8d73434e0b
Add ability to mark example skipped/pending mid-test
2021-06-09 21:57:17 -06:00
Michael Miller
ab6487cbfa
Merge branch 'release/0.10' into pending
2021-06-05 22:44:54 -06:00
Michael Miller
b9d77321b3
Fix premature call of after_all hook
2021-06-05 22:44:34 -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
15c5b0991d
Fix doc
2021-06-02 23:54:38 -06:00
Michael Miller
12f06abf11
Move profile JSON formatting into Profile class
2021-06-02 23:51:53 -06:00
Michael Miller
bd34b87e22
Simplify JSON formatter by reusing Example's to_json
2021-06-02 23:44:36 -06:00
Michael Miller
8536fcf58c
Fix full_description being an object
2021-06-02 23:41:23 -06:00
Michael Miller
98ba607583
Dumb whitespace
2021-06-02 23:37:01 -06:00
Michael Miller
835fa40773
Handle nil location
2021-06-02 23:35:41 -06:00
Michael Miller
39e917ce57
Consistent location fields
2021-06-02 23:09:30 -06:00
Michael Miller
8f3a7c0a5a
Basically done JSON formatter
2021-06-02 22:48:48 -06:00
Michael Miller
fa3e9dd34d
Implement JUnit formatter
2021-05-30 15:02:30 -06:00
Michael Miller
e30d5c1981
Use multiple << on a single line
2021-05-30 14:21:42 -06:00
Michael Miller
0a7909fb7a
Cleanup
2021-05-30 10:44:09 -06:00
Michael Miller
877831a98b
Add docs
2021-05-30 10:17:49 -06:00
Michael Miller
a4042a9684
Extend PendingBlock from ResultBlock and rename to PendingResultBlock
2021-05-30 10:02:25 -06:00
Michael Miller
7215e28d75
Implement TAP formatter
2021-05-29 23:09:28 -06:00
Michael Miller
40e189a1d1
Fix method name
2021-05-29 23:09:18 -06:00
Michael Miller
48fb293ba0
Define notification type for messages
2021-05-29 22:59:56 -06:00
Michael Miller
76c525de52
Fix call to example_finished
2021-05-29 22:47:53 -06:00
Michael Miller
f02e1acb3b
Remove lazy iteration
...
Fixes issue with empty? method eating the first example for failure and
pending lists.
2021-05-29 18:35:01 -06:00
Michael Miller
5e1ca34146
Fix pending results not being counted
2021-05-29 17:59:16 -06:00
Michael Miller
6d8d117ec2
Handle nodes with no name
2021-05-29 17:50:30 -06:00
Michael Miller
fccd55ed0a
Improve appearance of multi-line error messages
2021-05-29 17:33:45 -06:00
Michael Miller
76dd5603de
Fix harness not updating current
2021-05-29 17:13:14 -06:00
Michael Miller
99378c0f36
Merge branch 'release/0.10' into reporting
2021-05-19 20:15:51 -06:00
Michael Miller
a3305a9273
Merge branch 'master' into release/0.10
2021-05-19 20:15:36 -06:00
Michael Miller
e3576c8924
Add support for be ===
and be =~
...
Addresses https://github.com/icy-arctic-fox/spectator/issues/26
2021-05-19 19:46:46 -06:00
Michael Miller
453f6a2fce
Cleanup
2021-05-18 20:10:02 -06:00
Michael Miller
867c06bd67
Initial working document formatter
2021-05-18 20:01:58 -06:00
Michael Miller
1e2f3f7c66
Use index offset argument
2021-05-18 19:38:04 -06:00
Michael Miller
1addc46f7e
Remove parameter from stop method
2021-05-18 19:03:40 -06:00
Michael Miller
c0befe63e9
Don't use random seed unless randomized
2021-05-18 18:50:43 -06:00
Michael Miller
b970abd334
Limit generated seed to < 100,000
2021-05-16 20:39:35 -06:00
Michael Miller
1525317e2c
Pass along and output random seed
2021-05-16 20:38:02 -06:00
Michael Miller
36f9f2b434
Return true from run method if successful
2021-05-16 20:23:16 -06:00
Michael Miller
ebf04b360e
Add profiling info
2021-05-16 20:21:04 -06:00
Michael Miller
4bb4c2f16e
Dump profile before summary
2021-05-16 19:52:53 -06:00
Michael Miller
aa13b077f3
No need to type restrict io method
2021-05-16 19:47:07 -06:00
Michael Miller
1e3e0daa04
Place error count in parens next to failures
2021-05-16 19:42:15 -06:00
Michael Miller
aee171656a
Fix '<anonymous>' showing up for root group
2021-05-16 19:37:45 -06:00
Michael Miller
84ac41967b
Formatting
2021-05-16 19:29:20 -06:00
Michael Miller
cc09cb1b77
Cleanup and consolidate common code for result blocks
2021-05-16 19:28:59 -06:00
Michael Miller
f81c498aef
Add error block component
2021-05-16 17:14:09 -06:00
Michael Miller
ed3ad662d2
Move failure command list to its own component
2021-05-16 17:13:06 -06:00
Michael Miller
2316377c6e
Rename ExampleFilterCommand to ExampleCommand
2021-05-16 17:08:15 -06:00
Michael Miller
031e892dad
Rename SummaryBlock to Stats
2021-05-16 16:56:19 -06:00
Michael Miller
3ecb04e293
Initial work on summary output
2021-05-16 15:03:37 -06:00
Michael Miller
ee294a3ec2
Use Array instead of Enumerable
2021-05-16 13:22:25 -06:00
Michael Miller
0ed684afbc
Integrate report and summary events
2021-05-16 13:20:02 -06:00
Michael Miller
ceb368a7f4
Overhaul Report
2021-05-16 13:19:04 -06:00
Michael Miller
fb436d2ec4
Define a pending result as neither passing nor failing
2021-05-16 12:31:01 -06:00
Michael Miller
832ffbf403
Split to make it obvious run is called
2021-05-16 12:22:00 -06:00
Michael Miller
59c67c26a9
Result visitor methods should take result as argument
2021-05-16 12:19:16 -06:00
Michael Miller
9a62c1386a
Remove parameter from start_dump and close events
2021-05-16 10:51:50 -06:00
Michael Miller
ba2922e655
Implement broadcast formatter methods
2021-05-16 10:12:40 -06:00
Michael Miller
5da21f8ede
Update Ameba and address issues
2021-05-15 19:51:44 -06:00
Michael Miller
aa03e3527d
Formatting
2021-05-15 19:45:17 -06:00
Michael Miller
eebcba0749
Mostly implemented progress formatter
2021-05-15 19:45:01 -06:00
Michael Miller
e2f4051927
Split error handler from failure method
2021-05-15 19:44:06 -06:00
Michael Miller
a36982d6d6
Use visitor pattern
2021-05-15 19:43:13 -06:00
Michael Miller
d5c4d5e822
Call fail
instead of failure
on visitor
2021-05-15 19:42:59 -06:00
Michael Miller
618e9e195a
Begin triggering events for formatters
2021-05-15 18:31:52 -06:00
Michael Miller
4eb457f197
Define and document formatter methods
2021-05-15 17:01:29 -06:00
Michael Miller
1ea209184e
Formatting
2021-05-12 21:41:56 -06:00
Michael Miller
81f509c083
Get config, spec, builder, and runner working together
2021-05-12 21:41:34 -06:00
Michael Miller
83c4b01e84
Set up placeholder formatters
2021-05-12 21:41:12 -06:00
Michael Miller
ff084bb3cd
Fix dumb mistakes
2021-05-12 21:40:48 -06:00
Michael Miller
b8b6b3b609
Add pass?/fail? methods to Result types
2021-05-12 21:39:50 -06:00
Michael Miller
72b2e7ebcb
Fix paths and references
2021-05-08 23:46:19 -06:00
Michael Miller
7294f2da67
Change ConfigSource to "applicator"
...
Remove unecessary abstract base class.
Shorten name of CLI arguments config applicator.
2021-05-08 23:45:54 -06:00
Michael Miller
f09a6a87e5
Remove TestSuite middle-man object
2021-05-08 23:38:13 -06:00
Michael Miller
e7138080a6
Clean up and simplify Config and Builder
2021-05-08 23:37:33 -06:00
Michael Miller
8a4735b9e6
Use Formatters instead of Reporters (and Formatters)
2021-05-08 23:35:29 -06:00
Michael Miller
f2459cfe94
Override === to call includes?
...
Allows the use of a filter in pattern matching scenarios (select).
2021-05-08 23:33:59 -06:00
Michael Miller
e7c3d8f060
Use filter if only one is provided
...
This is less overhead than creating a composite filter for one child
filter.
2021-05-08 22:53:39 -06:00
Michael Miller
83d7657b18
Use enum flags for run modes
2021-05-08 22:51:54 -06:00
Michael Miller
e8848d6855
Merge branch 'release/0.10' into reporting
2021-05-08 13:23:57 -06:00
Michael Miller
88b323bc27
Move common inspect code up to Node
2021-05-08 13:22:13 -06:00
Michael Miller
d292c01e74
Remove direct references to Example in ExampleGroup
2021-05-08 12:43:41 -06:00
Michael Miller
ef7fca3f95
Bit of cleanup around parent/group
2021-05-08 12:10:27 -06:00
Michael Miller
d7ba47cc49
Clean up hook code
2021-05-08 12:00:29 -06:00
Michael Miller
e47e625016
Remove circular dependency with Node and ExampleGroup
2021-05-07 21:04:17 -06:00
Michael Miller
6bea36d8b6
Move Node out of Spec namespace
2021-05-07 20:09:33 -06:00
Michael Miller
d7bc376429
Some initial work on formatters
2021-05-07 20:05:00 -06:00
Michael Miller
31d819e4c9
Nuke formatting types to prep for new types
2021-05-06 22:11:38 -06:00
Michael Miller
f3afd74dc5
Empty classes for reporting
2021-05-06 22:10:59 -06:00
Michael Miller
ff5d855389
Cleanup harness some
2021-05-06 22:10:40 -06:00
Michael Miller
02b98ea61b
Remove reference to example from result
...
Pass examples instead of results into formatters.
2021-04-26 18:47:11 -06:00
Michael Miller
f24d634ccb
Merge branch 'release/0.10' into specs
2021-04-26 17:19:25 -06:00
Michael Miller
f549fcfa7a
Minor changes to configure methods
2021-04-26 17:17:18 -06:00
Michael Miller
6c98d7107c
Docs
2021-04-26 17:11:53 -06:00
Michael Miller
5dfc60d4cd
Fix nil reference error when example name is unavailable
2021-04-26 16:53:04 -06:00
Michael Miller
29594eefab
Merge branch 'master' into release/0.10
2021-04-26 11:19:08 -06:00
Michael Miller
f0b524dc47
Remove workaround
...
https://github.com/icy-arctic-fox/spectator/issues/1 should be resolved
by https://github.com/crystal-lang/crystal/pull/8234
2021-04-20 19:27:41 -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
5bd911341b
Set end_line equal to line if end_line not provided
2021-03-30 15:29:51 -04: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
86a85c0946
Missed a method that should be private
2021-02-09 23:27:00 -07:00
Michael Miller
8b5fd099bb
More docs
2021-02-09 22:50:09 -07:00
Michael Miller
8232da1167
Mark DSL generated methods as private
2021-02-09 22:40:15 -07:00
Michael Miller
7a5f7adfc2
Change Anything to only use case equality
2021-02-09 21:18:20 -07:00
Michael Miller
a20f2d4f98
Test and improve "Anything"
2021-02-09 19:10:11 -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
a20b7cad80
Workaround for case where wrapper might store a type
2021-01-30 23:49:20 -07:00
Michael Miller
e275711f2b
Formatting
2021-01-30 23:48:59 -07:00
Michael Miller
ff49c674c6
Fix around_each hook ordering when at the same level
2021-01-30 21:15:20 -07:00
Michael Miller
0f44403053
Fix namespaces preventing structs from being mocked
2021-01-30 21:11:51 -07:00
Michael Miller
0332b6eb3b
Log when deferred operations run
2021-01-30 21:07:42 -07:00
Michael Miller
292dfcbe29
Ignore nameless groups in document hierarchy
2021-01-30 21:00:28 -07:00
Michael Miller
e44505d4c1
Set nameless example to matcher description
2021-01-30 21:00:01 -07:00
Michael Miller
82e13f5434
Sloppily handle deferred operations
2021-01-30 20:53:09 -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
948e29a8b7
Fix short-hand should syntax
2021-01-30 20:27:36 -07:00
Michael Miller
62d478f7c2
Prevent overly verbose output of internals
2021-01-30 20:20:30 -07:00
Michael Miller
9743f37e5c
Capture reported expectations
2021-01-30 20:07:45 -07:00
Michael Miller
bda554739c
Re-add JSON output for some types
2021-01-30 20:07:36 -07:00
Michael Miller
9d139dfeed
Hack together result output
2021-01-30 19:42:46 -07:00
Michael Miller
17a3f27029
Address Ameba errors
2021-01-30 18:57:29 -07:00
Michael Miller
e8b284fc60
Fix namepsaces
...
crystal spec compiles again!
2021-01-30 17:40:33 -07:00
Michael Miller
b6335ab4bc
Update includes list
2021-01-30 17:40:03 -07:00
Michael Miller
d3ad0963cd
Minor fixes
2021-01-30 17:31:50 -07:00
Michael Miller
b07dca697e
Remove seemingly unused context stubs code
2021-01-30 17:27:17 -07:00
Michael Miller
3b5086c74b
Re-add mocks to harness
2021-01-30 17:27:02 -07:00
Michael Miller
73985772b7
DSL fully added back in
2021-01-30 16:43:13 -07:00
Michael Miller
d43d309a47
Note about tag inheritence
2021-01-30 16:39:41 -07:00
Michael Miller
3bc567da4c
Skip examples marked pending
2021-01-30 16:36:15 -07:00
Michael Miller
2301e44bd1
Add pending? method
2021-01-30 16:05:32 -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
fdc2a71dd5
Formatting
2021-01-30 12:07:45 -07:00
Michael Miller
c5246e1cd3
Promote Tags to the Spectator namespace
2021-01-30 12:07:23 -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
71a497b148
Move tags to node level
2021-01-30 11:20:20 -07:00
Michael Miller
8cf498c9e9
Switch to using tags instead of metadata
2021-01-30 11:13:30 -07:00
Michael Miller
11cb16fb3a
Add missing call to super
2021-01-30 10:14:09 -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
76378c9dae
Whitespace
2021-01-21 21:05:12 -07:00
Michael Miller
a8840351d5
More work hooking up expectations
2021-01-21 00:03:57 -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
f97e5365e3
Merge branch 'example-api' of gitlab.com:arctic-fox/spectator into example-api
2021-01-16 18:05:48 -07:00
Michael Miller
73dc7ae811
Fix copy/paste docs
2021-01-16 17:16:31 -07:00
Michael Miller
a7ac170153
Remove unused methods
2021-01-16 17:07:07 -07:00
Michael Miller
57c9333c1f
Match hook ordering of RSpec
...
Addresses https://github.com/icy-arctic-fox/spectator/issues/12
2021-01-16 17:04:42 -07:00
Michael Miller
cd519178ac
Remove whitespace
2021-01-16 16:52:41 -07:00
Michael Miller
13061cfb38
Workaround context scope not used in method delegation
2021-01-16 16:52:16 -07:00
Michael Miller
153933b044
Add DSL and code to create around_each hooks
2021-01-16 16:47:40 -07:00
Michael Miller
36c2a5d368
Logic for around_each hooks
2021-01-16 16:28:33 -07:00
Michael Miller
5ea83f51bb
Cache implicit subject
2021-01-16 12:10:52 -07:00
Michael Miller
d738494fdf
Cleanup example name output
2021-01-16 11:49:43 -07:00
Michael Miller
3527507639
Remove debug
2021-01-16 11:13:20 -07:00
Michael Miller
3ec267abbb
Fix reporting for should syntax
2021-01-16 11:12:41 -07:00
Michael Miller
97923d6bcd
Handle nil labels
2021-01-16 11:11:42 -07:00
Michael Miller
0992bad7eb
Get harness compiling again
2021-01-16 11:03:05 -07:00
Michael Miller
175ce8f293
Include matchers DSL
2021-01-16 11:02:49 -07:00
Michael Miller
4500ebcddc
Update old references to Value and Block
2021-01-16 11:02:29 -07:00
Michael Miller
58e7981b0c
Fix type warning
2021-01-16 11:00:54 -07:00
Michael Miller
e09f5c960a
Change Assertions to Expectations
...
Start expectation rework.
2021-01-16 10:22:23 -07:00
Michael Miller
50d1f69230
Don't cache the block return value
...
Let the matcher handle this if it needs to.
2021-01-15 23:15:07 -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
4108a6602d
Simplify get method
2021-01-09 16:57:23 -07:00
Michael Miller
3e4b77da77
Create value wrapper
2021-01-09 16:51:37 -07:00
Michael Miller
aa4c257ade
Change Wrapper to a nested type for Lazy
2021-01-09 14:35:58 -07:00
Michael Miller
5cac4aa5a1
Add lazy utility
2021-01-09 14:19:40 -07:00
Michael Miller
fb0423ed02
Move top-level types into spectator/ sub-directory
2021-01-09 13:56:32 -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
fbd9713d52
Remove unused and deprecated types
2021-01-09 12:56:35 -07:00
Michael Miller
2e8036d230
Move instance variable
2021-01-09 12:48:53 -07:00
Michael Miller
65dba9f317
Don't need delegates stored in hooks
...
Use proc instead. The context can be retrieved from the example
instance.
2021-01-09 12:04:27 -07:00
Michael Miller
c4289b82da
Better trace message for initial hook processing
2021-01-09 11:33:29 -07:00
Michael Miller
df096d91aa
Capture source info for hooks
2021-01-09 11:30:00 -07:00
Michael Miller
def66acc15
Trace hook invocation
2021-01-09 11:14:27 -07:00
Michael Miller
e5cbc8d631
Promote hooks to fully-fledge types
...
Hook types include a source, label, and context delegate.
2021-01-09 11:06:59 -07:00
Michael Miller
cf422eca02
Add null constructor
2021-01-09 10:56:33 -07:00
Michael Miller
7d0ba752e9
Change ExampleNode to SpecNode
2021-01-09 10:39:04 -07:00
Michael Miller
0ee708281f
Cleanup hook macros
2021-01-09 10:27:54 -07:00
Michael Miller
950f6b3424
Add block expression
2021-01-09 00:13:22 -07:00
Michael Miller
fbe9f22e02
Start rework on capturing expressions
2021-01-09 00:12:28 -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
Michael Miller
b697511761
Slight doc improvement
2020-12-31 18:45:56 -07:00
Michael Miller
4c6b6e6436
Merge branch 'master' into example-api
2020-12-23 14:52:53 -07:00
Michael Miller
891cd4bbf7
Change includes to has
2020-12-23 14:39:24 -07:00
Michael Miller
20caed9262
Add contain matcher improvements to have matcher
2020-12-23 14:38:30 -07:00
Michael Miller
edf8ae36df
Fix negated contain case
2020-12-23 14:19:40 -07:00
Michael Miller
a2ef0fa46a
Consistent comments
2020-12-23 14:17:05 -07:00
Michael Miller
de1af7178c
Fix string usage with contain matcher
2020-12-23 14:11:50 -07:00
Michael Miller
875ca587f3
Show missing values in error output
2020-12-23 13:44:12 -07:00
Michael Miller
f465df48d4
Fix copy/paste fail docs
2020-12-23 13:18:36 -07:00
Michael Miller
5ec7e25d57
Remove splat
2020-12-23 12:54:44 -07:00
Michael Miller
0540f94823
Add contain_elements and have_elements variants
2020-12-23 12:38:37 -07:00
Michael Miller
4533cffce7
Initial code to run hooks
2020-11-15 11:25:07 -07:00
Michael Miller
2f4cbd9c33
Specify contents of event trigger method with macro block
...
Implement calling parent group hooks.
2020-11-15 11:22:52 -07:00
Michael Miller
0279606a1c
Placeholder code for after hooks
2020-11-15 11:22:06 -07:00
Michael Miller
19d57dd828
Add call_once variant of events
2020-11-14 17:02:24 -07:00
Michael Miller
b4e74444d1
Some work on hooks in DSL
2020-11-08 22:21:52 -07:00
Michael Miller
7d54884196
Don't pass context, get/cast from example instance
2020-11-08 16:53:54 -07:00
Michael Miller
b8dc83286c
Upcast context to reduce method instances generated by compiler
2020-11-08 16:52:08 -07:00
Michael Miller
f433405ece
Scratch work
...
Trying to implement hooks. Ran into a problem with contexts.
2020-11-08 15:06:49 -07:00
Michael Miller
688c08b087
Initial work on hooks rework
2020-11-07 22:04:37 -07:00
Michael Miller
1f319a70ce
Add docs
2020-11-07 22:04:21 -07:00
Michael Miller
4230ec70a0
Move test handling code to Harness
2020-11-07 20:56:30 -07:00
Michael Miller
dba2e23750
Typo
2020-11-07 15:24:22 -07:00
Michael Miller
f7fe177685
Minor adjustments
2020-11-07 15:01:08 -07:00
Michael Miller
8ae6ef478b
Dynamic examples with null context
2020-11-07 14:43:59 -07:00
Michael Miller
40dd85eb38
Bit of naming cleanup
2020-11-07 13:47:39 -07:00
Michael Miller
347e1a84e5
Dedicated example runner type
2020-11-07 13:47:31 -07:00
Michael Miller
b8901d485d
Merge branch 'master' into example-api
2020-11-07 11:18:47 -07:00
Michael Miller
b91103b40a
Handle case where block is provided with return type
2020-11-07 11:04:03 -07:00
Michael Miller
8966c0976b
Allow manual specification of return type
2020-11-07 10:56:33 -07:00
Michael Miller
e8afe5070b
Address Ameba issues
2020-10-19 20:34:18 -06:00
Michael Miller
a0e6d5c4e8
Re-introduce config options
2020-10-19 20:19:25 -06:00
Michael Miller
c36e006c85
Move top-level DSL to its own module
2020-10-17 22:57:27 -06:00
Michael Miller
87c8914187
Typo
2020-10-17 22:12:47 -06:00
Michael Miller
e4f3d334ed
Consistent naming of random seed
2020-10-17 22:12:02 -06:00
Michael Miller
225e1a52ba
Clean up example randomization
2020-10-17 22:11:04 -06:00
Michael Miller
b2bf980685
Some config cleanup
2020-10-17 21:39:41 -06:00
Michael Miller
79499c5d2e
Add config to spec builder
2020-10-17 17:40:38 -06:00
Michael Miller
4462f27316
Rework result types
2020-10-17 14:56:31 -06:00
Michael Miller
788b12a8bc
Fix example methods overriding previously defined methods
2020-10-17 12:12:04 -06:00
Michael Miller
27875631d3
Mostly implement inspect method
2020-10-17 11:51:16 -06:00
Michael Miller
9c1fd6fb5a
Use standard log utility
2020-10-17 11:46:21 -06:00
Michael Miller
e6d78345c4
Rename debug macro
2020-10-17 11:25:46 -06:00
Michael Miller
4974054de7
Some code to run a spec
2020-10-17 11:23:51 -06:00
Michael Miller
9ac6121201
New stub syntax to support operator methods
...
Works like:
stub :[], index : Int32 { 42 }
Addresses https://github.com/icy-arctic-fox/spectator/issues/14
2020-10-01 18:23:28 -06:00
Michael Miller
f71a8ac6a3
Merge branch 'master' into example-api
2020-09-27 12:46:38 -06:00
Michael Miller
e68697a212
Fix stubbed yielding method calling original instead of stub
2020-09-27 10:30:51 -06:00
Michael Miller
0970f02465
Yield instead of forwarding block
...
Forwarding the block like this captures it, which prevents yield from
being used.
Addresses https://gitlab.com/arctic-fox/spectator/-/issues/54
2020-09-27 10:14:30 -06:00
Michael Miller
ec6018bed4
Start reactivating runner
2020-09-27 09:10:27 -06:00
Michael Miller
579fcacfde
Move spec builder
2020-09-26 22:51:58 -06:00