Michael Miller
6e62ccdfc5
Update TypeMatcher to use MatchData
2019-03-06 11:19:57 -07:00
Michael Miller
81e20b13ec
Update PredicateMatcher to use MatchData
2019-03-06 11:05:13 -07:00
Michael Miller
6ab2aad532
Update HaveMatcher to use MatchData
2019-03-06 10:29:00 -07:00
Michael Miller
a78b80ed1f
Update StartWithMatcher to use MatchData
2019-03-06 09:33:36 -07:00
Michael Miller
76d09a22ff
Update HaveValueMatcher to use MatchData
2019-03-06 02:19:12 -07:00
Michael Miller
3f1d8751fe
Update HaveKeyMatcher to use MatchData
2019-03-06 02:02:55 -07:00
Michael Miller
95b4a349da
Update InequalityMatcher to use MatchData
2019-03-05 19:00:49 -07:00
Michael Miller
d35a739e60
Update LessThanMatcher to use MatchData
2019-03-05 16:53:15 -07:00
Michael Miller
f846408848
Update LessThanEqualMatcher to use MatchData
2019-03-05 16:37:51 -07:00
Michael Miller
36d3bd0a70
Update GreaterThanMatcher to use MatchData
2019-03-05 16:28:29 -07:00
Michael Miller
83d398465f
Update GreaterThanEqualMatcher to use MatchData
...
Add PrefixedValue type to help convey values better (without string
concat).
2019-03-05 15:39:30 -07:00
Michael Miller
27409f4a92
Display last item and full list when #last is used
...
Only perform one check with #responds_to?.
2019-03-05 13:52:59 -07:00
Michael Miller
52f8c52a58
Fix EndWithMatcher compile errors
2019-03-04 21:43:26 -07:00
Michael Miller
7b0f607a6a
Update EndWithMatcher to use MatchData
2019-03-04 20:16:21 -07:00
Michael Miller
1090a7f2f3
Fix botched copy/paste
2019-03-04 18:30:18 -07:00
Michael Miller
e7441df159
Update AttributesMatcher to use MatchData
...
This is a glorious mess.
2019-03-04 16:06:20 -07:00
Michael Miller
df663d30d9
Update EmptyMatcher to use MatchData
2019-03-03 20:21:39 -07:00
Michael Miller
be3218bcd8
Update ContainMatcher to use MatchData
2019-03-03 20:03:20 -07:00
Michael Miller
cdef7f9fa3
Use macro yield and remove &block when not needed
2019-03-03 19:24:56 -07:00
Michael Miller
51765c0c8b
Fix strange compiler error
...
Compiler said there was an error, but not what it was.
The compiler wasn't clear where the issue was either.
2019-03-03 19:06:37 -07:00
Michael Miller
e38bcd544a
Update CaseMatcher to use MatchData
2019-03-03 19:05:20 -07:00
Michael Miller
50a782b803
Minor adjustments to equality matcher
2019-03-03 12:26:31 -07:00
Michael Miller
ffed61b9e3
Implement condensed document output
2019-03-03 11:56:43 -07:00
Michael Miller
52a6a645b9
Display group names
2019-03-03 11:05:28 -07:00
Michael Miller
f338e9b99d
Add -v argument to use document formatter
2019-03-03 10:52:15 -07:00
Michael Miller
a3c4d06e45
WIP code for document formatter (-v)
2019-03-03 10:51:52 -07:00
Michael Miller
ca92fbb29f
Extend self in Spectator module
2019-03-03 10:49:28 -07:00
Michael Miller
5481c3d431
Formatting
2019-03-03 10:32:00 -07:00
Michael Miller
8310ea2aa5
Label exception with type
2019-03-03 10:30:58 -07:00
Michael Miller
6307024af3
Colorize matcher values green and red
2019-03-03 10:26:03 -07:00
Michael Miller
df71e56b3e
Replace FailureMessage with LabeledText
2019-03-03 10:19:17 -07:00
Michael Miller
2c5da0c345
Move message line inside content
...
This allows for multiple message lines for multiple expectations.
2019-03-03 10:11:46 -07:00
Michael Miller
238dc38a36
Use Indent tracker type
2019-03-03 09:54:39 -07:00
Michael Miller
8cdc5f0b3f
Fix indent and add empty line method
2019-03-03 09:54:09 -07:00
Michael Miller
f73a51ae0c
WIP display all expectations
...
Display the error stacktrace after expectations if the result is an
ErroredResult.
2019-03-03 09:48:44 -07:00
Michael Miller
66c1dc3bce
Create indentation guide type
2019-03-03 09:46:12 -07:00
Michael Miller
e722cc4f1f
Initial code for displaying errors
2019-02-28 22:16:33 -07:00
Michael Miller
f37105af5e
Add padding to pairs to right-align key
2019-02-28 20:14:03 -07:00
Michael Miller
cc3392022e
Move value enumeration to another type
2019-02-28 19:49:23 -07:00
Michael Miller
0fce18a610
Use inspect instead of to_s for values
2019-02-28 19:29:24 -07:00
Michael Miller
daf2f43f25
Rename module from Formatters to Formatting
2019-02-28 19:14:03 -07:00
Michael Miller
80150f945b
Change back to passing text as argument
2019-02-28 16:48:26 -07:00
Michael Miller
1610d6ebe3
Create a type to output a key-value pair
2019-02-28 16:46:50 -07:00
Michael Miller
4e3290ebfe
Initial code to get match data values to output
...
Expose the match data values through the Expectation class.
2019-02-28 16:35:50 -07:00
Michael Miller
0a48b5f447
Use block with line method
2019-02-28 16:30:56 -07:00
Michael Miller
d5bef6f1da
Fix flipped expected and actual labels
...
NilMatcher output was correct, but variables were named incorrectly.
2019-02-28 16:08:22 -07:00
Michael Miller
1219b19d89
Support shorthand &.foo(ARGS) syntax
2019-02-28 15:40:04 -07:00
Michael Miller
619927b3e6
Forgot to swap label and expected in DSL
2019-02-28 15:22:14 -07:00
Michael Miller
5ba03a90ff
Swap label and expected value parameters
...
This matches the partial initializer parameters.
Also cleaned up some code in the Expectation spec.
2019-02-28 15:17:12 -07:00
Michael Miller
f3e50c6432
TruthyMatcher doesn't need to store a label
...
Extend from Matcher instead of ValueMatcher to bypass storing the label.
The "expected" value is still used, but is renamed to "truthy" and used
for the label.
2019-02-28 14:52:15 -07:00
Michael Miller
226708cb82
Abstract Matcher#label getter
...
There's no need to store a value for this.
Some matchers have a static label.
2019-02-28 14:48:46 -07:00
Michael Miller
8cc66b538f
Condense the ExpectedActual initializer
...
Made label and expected value public.
2019-02-28 14:41:30 -07:00
Michael Miller
4c7e8a3225
Condense expected and actual values and labels
...
Created a new struct specifically to store expected and actual valuesand
their user labels.
2019-02-28 14:05:31 -07:00
Michael Miller
520901332e
Remove dummy MatchData type
...
Also fix for undefined MatchData type in Matcher types.
2019-02-28 13:53:54 -07:00
Michael Miller
e6ce54202d
Remove Matcher methods moved to MatchData
...
Update spec for EqualityMatcher to reflect this.
2019-02-28 13:47:50 -07:00
Michael Miller
b4502711cd
Add MatchData for EqualityMatcher
...
crystal spec runs, but fails for this commit.
2019-02-28 13:32:38 -07:00
Michael Miller
b855599ce6
Workaround for strange compiler error
2019-02-28 10:53:03 -07:00
Michael Miller
c1f61d68bf
Use MatchData
2019-02-26 20:29:04 -07:00
Michael Miller
0bf106ab2e
Placeholders for #match method
2019-02-23 22:33:33 -07:00
Michael Miller
42d8eb6da3
Matched flag isn't needed (match data has it)
2019-02-23 22:26:49 -07:00
Michael Miller
1e1503331e
Initial change to MatchData
2019-02-23 21:52:10 -07:00
Michael Miller
87ca825845
Return 1 on failure
2019-02-22 16:54:36 -07:00
Michael Miller
487726ea54
Move failure command it's own type
2019-02-22 16:43:25 -07:00
Michael Miller
e92b1dc466
Add #failed? method to Report
2019-02-22 15:09:55 -07:00
Michael Miller
dbffad837d
Calculate each type of result once at initialization
2019-02-22 13:54:12 -07:00
Michael Miller
5c2747efc0
Move stats to their own types
2019-02-22 13:47:57 -07:00
Michael Miller
48a1e61949
Change FailueBlock to a private struct
2019-02-20 21:47:18 -07:00
Michael Miller
0ca300ba89
Move characters constant to sub-module
2019-02-20 21:38:23 -07:00
Michael Miller
e752f901a5
Move more failure block chunks to their own structs
2019-02-20 21:28:11 -07:00
Michael Miller
bef3243c6c
Remove unecessary result parameter
2019-02-20 21:22:42 -07:00
Michael Miller
002c1d892b
Adjust how Result#call works
2019-02-20 21:00:22 -07:00
Michael Miller
8f85a6436f
Rewrite to use indentation methods
2019-02-20 20:09:23 -07:00
Michael Miller
1cd0f0249e
Create struct for colorized comment
2019-02-19 19:56:07 -07:00
Michael Miller
4126ee3451
Some work on FailureBlock
2019-02-17 23:15:58 -07:00
Michael Miller
f2c17189fc
Adjust (mostly remove) explicit return types
2019-02-17 23:12:16 -07:00
Michael Miller
b646b8bec5
Remove unused ExampleStatus enum
2019-02-17 23:09:23 -07:00
Michael Miller
eaf1d19feb
Move the expectations attribute up to FinishedResult
2019-02-17 23:03:43 -07:00
Michael Miller
847cc662bd
Update docs
...
Mostly fixes around symbols for syntax.
Added some missing docs and updated incorrect or vague ones.
2019-02-17 23:01:43 -07:00
Michael Miller
9c16a5a53e
Move characters to a named tuple
2019-02-17 21:35:17 -07:00
Michael Miller
bd500b0799
Move color constants to a private named tuple
2019-02-17 21:32:42 -07:00
Michael Miller
1a998b6cb6
Add comment color
2019-02-17 21:30:41 -07:00
Michael Miller
2c7cd9b728
Add #path method
...
Update #to_s to use relative path if possible.
2019-02-17 21:23:57 -07:00
Michael Miller
dc7d5fbe25
Lazy iterate over failures and errors
...
Return iterator from #failures and #errors methods in Report.
Update spec to reflect this.
2019-02-17 20:09:13 -07:00
Michael Miller
32a049d973
Colorize must be explicitly dragged in
2019-02-17 20:05:32 -07:00
Michael Miller
6601f5f9ee
Remove DefaultFormatter
...
The default formatter is now DotsFormatter.
2019-02-17 17:39:04 -07:00
Michael Miller
ace31973bc
Whitespace
2019-02-17 17:05:59 -07:00
Michael Miller
1885ab0aa0
Fix leading space when group isn't symbolic
2019-02-17 17:05:10 -07:00
Michael Miller
f6a4e6f558
Remove space in #to_s between symbolic items
...
This makes example names look more like documentation by changing names
like "Array #size is zero" to "Array#size is zero".
2019-02-17 16:29:38 -07:00
Michael Miller
8339784492
Add symbolic attribute to example components
...
This is used to determine whether a type or method is referenced.
2019-02-17 16:27:41 -07:00
Michael Miller
968775a5c3
Some cleanup and docs for SuiteSummary
2019-02-17 15:13:24 -07:00
Michael Miller
d63a480516
Initial cleanup and docs for FailureBlock
2019-02-17 15:02:07 -07:00
Michael Miller
0f5395d592
Remove call to source in failure block
2019-02-17 14:54:33 -07:00
Michael Miller
11c738b941
Use Result#call instead of case-statement
...
Color module is no longer mixed-in.
2019-02-17 14:48:54 -07:00
Michael Miller
75f9a5838b
Add #call
method to each result
...
This feels like a good middle-ground.
I didn't want this to be a factory method, or return an instance.
That seemed like overkill for formatting.
But I don't want to place if and case-statements everywhere in the
formatters.
I hope this doesn't violate single-responsibility principle or any other
guidelines.
2019-02-17 14:24:02 -07:00
Michael Miller
0b06e72f7e
Simplify method chains by using #compact_map
2019-02-17 13:40:10 -07:00
Michael Miller
3a508cae26
Update Report class to not use result predicates
2019-02-17 13:36:10 -07:00
Michael Miller
8dd8db74b9
Remove predicate methods from Result types
2019-02-17 13:15:40 -07:00
Michael Miller
ed01a95e67
Replace source file and line with source struct
2019-02-17 12:40:16 -07:00
Michael Miller
dc66b184e2
Add source class
2019-02-17 12:25:23 -07:00
Michael Miller
04bccd162e
Use @io instead of STDOUT
2019-02-15 23:10:08 -07:00
Michael Miller
49175e56ac
Initial code for summary output
2019-02-15 23:05:48 -07:00
Michael Miller
e8ca350152
Allow output to be printed to other streams
2019-02-15 22:12:18 -07:00
Michael Miller
2012db85c5
Initial code for refactoring formatters
2019-02-15 22:09:53 -07:00
Michael Miller
ac5c2bbe47
Reorder source arguments and simplify
2019-02-14 16:19:49 -07:00
Michael Miller
61e92951ae
Add source file and line number to expectations
2019-02-14 16:04:09 -07:00
Michael Miller
5913a4c18f
Add source file and line number
...
The issue with nested macros losing their source location has been
fixed!
2019-02-14 15:41:26 -07:00
Michael Miller
f19b33d7a2
Add spec for Report and fix some bugs
2019-02-14 14:25:46 -07:00
Michael Miller
600c9fbde1
Reorder methods
2019-02-12 23:43:43 -07:00
Michael Miller
d0a8a1deae
Cast failure and error results
2019-02-12 23:34:56 -07:00
Michael Miller
8c5760e8dd
Rename methods for clarity
2019-02-12 23:18:04 -07:00
Michael Miller
6f08101828
Add docs to Report class
2019-02-12 23:13:03 -07:00
Michael Miller
493e30acee
Remove elapsed time from pending results
2019-02-12 16:36:06 -07:00
Michael Miller
142011a763
Add a silent formatter
2019-02-12 13:48:51 -07:00
Michael Miller
ff7fcc6a68
Utility method for getting default config
2019-02-12 13:45:48 -07:00
Michael Miller
5af9799df0
Pass test suite instance to #start_suite
2019-02-12 12:58:54 -07:00
Michael Miller
56c5d7c888
Add docs
2019-02-12 12:55:32 -07:00
Michael Miller
eef1062775
Rename TestSuiteResults to Report
2019-02-11 13:50:57 -07:00
Michael Miller
3d67c45a22
Add docs
2019-02-10 23:05:16 -07:00
Michael Miller
55b655e90a
Update naming and fresh variables
2019-02-10 01:20:30 -07:00
Michael Miller
fc3a7285a0
Rename "wrapper" to test code/instance
2019-02-10 01:03:32 -07:00
Michael Miller
e14e86a5f3
Add have_value
matcher
2019-02-05 19:37:25 -07:00
Michael Miller
7698724241
Update old naming to new matcher name
2019-02-05 19:30:44 -07:00
Michael Miller
c6b4e22666
Add have_key
matcher
2019-02-05 12:47:50 -07:00
Michael Miller
6bfd15b7f9
Parameterless initializer that generates the label
2019-02-05 10:36:37 -07:00
Michael Miller
0e0b8f4ae2
Base PredicateMatcher off of Matcher
...
No need to store an expected value.
Matcher's initializer must be public.
2019-02-05 10:14:33 -07:00
Michael Miller
89208b8ed1
Implement predicate matcher
...
Took a trick I learned from `have_attributes` and applied it here.
2019-02-04 22:52:09 -07:00
Michael Miller
1c9cb41fa2
Add have_attributes
matcher
...
This one is kind of magical.
2019-02-01 22:24:06 -07:00
Michael Miller
0c4ffdf587
Allow have
matcher to take multiple values
2019-02-01 20:27:51 -07:00
Michael Miller
6d90966f93
Update doc
2019-02-01 20:17:46 -07:00
Michael Miller
85b4e6894b
Allow contain
matcher to take multiple values
2019-02-01 19:43:42 -07:00
Michael Miller
5389a39231
Add DSL for be_close
matcher
2019-02-01 19:10:28 -07:00
Michael Miller
4ea439622d
Implement have
matcher
...
This is very similar to the `contain` matcher.
I would have used `include` for the matcher name, but it is a keyword
that can't be used in this syntax.
2019-02-01 16:25:45 -07:00
Michael Miller
f4ac7a3405
Add contain
matcher
2019-01-31 23:06:00 -07:00
Michael Miller
d0711f940d
Add end_with
matcher
2019-01-31 22:05:27 -07:00
Michael Miller
0a310cb243
Add start_with
matcher
2019-01-31 16:43:43 -07:00
Michael Miller
5c219195e1
Formatting
2019-01-31 13:55:36 -07:00
Michael Miller
e2779822b5
Remove unecessary type restrictions
2019-01-31 13:52:41 -07:00
Michael Miller
a53bafe333
Remove (now pointless) ConditionMatcher
2019-01-31 13:42:24 -07:00
Michael Miller
5ac9020f25
Move abstract #match?, #message, and #negated_message to base class
2019-01-31 13:40:32 -07:00
Michael Miller
a633d41fae
Move #eval to base class
...
Code is identical across sub-classes.
2019-01-31 13:34:09 -07:00
Michael Miller
3731b6d785
Remove BlockExpectation
2019-01-31 13:32:34 -07:00
Michael Miller
1ce594051c
Remove sub-class and abstract base for Expectation
...
This was over-engineered and only the base class is needed.
2019-01-31 13:29:26 -07:00
Michael Miller
46a6a4e51e
Remove reference to short-hand for non-block macro
2019-01-28 16:58:36 -07:00
Michael Miller
61200765c0
Add block expectation and partial
2019-01-28 15:56:04 -07:00
Michael Miller
69ffaa3796
Update doc
2019-01-28 15:47:01 -07:00
Michael Miller
61a3e6b113
Remove unecessary type restrictions
2019-01-28 10:04:17 -07:00
Michael Miller
592d13d0d4
Move #to and #to_not to base type
...
Remove some explicit type restrictions.
2019-01-28 01:09:22 -07:00
Michael Miller
5231f0fd39
Copy/paste fail
2019-01-26 17:07:21 -07:00
Michael Miller
30582f9a89
Add empty matcher to DSL
2019-01-26 17:04:46 -07:00
Michael Miller
ed3f524f8d
Add empty matcher
2019-01-26 17:02:42 -07:00
Michael Miller
028065ad26
Add #be_nil to DSL
2019-01-26 16:42:58 -07:00
Michael Miller
5c68e7eb52
Create parameter-less initializer
2019-01-26 16:40:51 -07:00
Michael Miller
840da3a8b7
Derive type matcher from condition matcher
2019-01-26 16:26:26 -07:00
Michael Miller
69d0856256
Add nil matcher
2019-01-26 16:24:17 -07:00
Michael Miller
90de8c312d
Create abstract conditional matcher
2019-01-26 16:23:16 -07:00
Michael Miller
90c5364946
Can't use "new" by itself like in Ruby
2019-01-25 13:25:40 -07:00
Michael Miller
abc321130a
Add DSL for range matching
2019-01-25 13:20:38 -07:00
Michael Miller
3be2302df9
Add range modifier methods
2019-01-25 13:20:17 -07:00
Michael Miller
bc45a3bf41
Add basic range matcher
2019-01-25 13:00:19 -07:00
Michael Miller
154832e5c4
Add be_an
variation of be_a
2019-01-25 11:21:41 -07:00
Michael Miller
c31557e8ff
Move everything in BeComparison to TruthyMatcher
...
This is to match RSpec's ability to use "be" by itself.
For instance: `expect(foo).to be`
2019-01-23 22:10:03 -07:00
Michael Miller
28c13cd175
Add xit
to DSL
2019-01-23 21:57:16 -07:00
Michael Miller
e746ede287
Add specify
to DSL
2019-01-23 21:56:02 -07:00
Michael Miller
0c284b6713
Add other comparison matchers to DSL
2019-01-23 21:45:16 -07:00
Michael Miller
d02e5d33b4
Add inequality matcher
2019-01-23 20:39:52 -07:00
Michael Miller
93801553b6
Implement equality method for BeComparison
2019-01-23 20:38:23 -07:00
Michael Miller
9ccba7570e
Add greater-than-equal-to matcher
2019-01-23 20:37:33 -07:00
Michael Miller
ea6d7eac2a
Add greater-than matcher
2019-01-23 20:34:53 -07:00
Michael Miller
52d0e6d55e
Add less-than-equal-to matcher
2019-01-23 20:33:21 -07:00
Michael Miller
4ccc27321e
Add less-than matcher
2019-01-23 20:31:28 -07:00
Michael Miller
f7d5c27e65
Should be ExpectedType instead of ActualType
2019-01-23 20:25:06 -07:00
Michael Miller
b93ef1fd2d
Initial structure for "be OP value" syntax
2019-01-23 17:17:45 -07:00
Michael Miller
57c15b9088
Split #expects macro
2019-01-23 16:48:12 -07:00
Michael Miller
78698d2de9
Can't support multiple arguments (expected values)
...
The macro would only "attach" `.to` to the last partial.
2019-01-23 16:43:59 -07:00
Michael Miller
17c66dd732
Split #expect macro
...
TIL Crystal supports macro overloading, the argument count must be
different.
2019-01-23 16:42:17 -07:00
Michael Miller
046d946669
Handle case of missing block body for #given better
2019-01-23 16:31:54 -07:00
Michael Miller
3d4d8f67be
Document truthy flag
2019-01-23 16:07:26 -07:00
Michael Miller
a827b191a1
Use #actual instead of #value
2019-01-23 16:05:59 -07:00
Michael Miller
8c6552a995
Add DSL for be_truthy
and be_falsey
2019-01-23 15:51:52 -07:00
Michael Miller
9befd5ee4f
Add truthy matcher
2019-01-23 15:51:36 -07:00
Michael Miller
429c2d7302
Add #be_true and #be_false to DSL
2019-01-23 15:35:32 -07:00
Michael Miller
0af3efea2a
Document pre- and post-condition run methods
...
Mark pre- and post-condition functionality complete in README.
2019-01-23 15:15:01 -07:00
Michael Miller
2f5e59d88b
Fix failing test
...
Pre-conditions with parent running out-of-order.
2019-01-23 15:13:27 -07:00
Michael Miller
ed8fad2c97
Add documentation for pre- and post-conditions
2019-01-23 14:37:43 -07:00
Michael Miller
260e1884ab
Implement match
(regex) matcher
2019-01-19 14:40:14 -07:00
Michael Miller
419b1322bf
Create parameterless initializer for TypeMatcher
2019-01-19 14:28:52 -07:00
Michael Miller
e66c0abcfb
Change described_class
to a macro
2019-01-19 14:17:28 -07:00
Michael Miller
46875d7770
Implement be_a
matcher
2019-01-19 14:08:50 -07:00
Michael Miller
4a7167597b
Remove documentation for unsupported cases
...
Turns out the `case` keyword does some extra magic that isn't trivially
implemented.
2019-01-19 13:44:38 -07:00
Michael Miller
45cdef021b
Swap operands to get expected result
2019-01-19 13:42:45 -07:00
Michael Miller
4a1b646015
Fix type resolution issue, force to Result
2019-01-19 13:37:34 -07:00
Michael Miller
a3ee53ed33
Implement be
matcher
2019-01-19 13:29:10 -07:00
Michael Miller
6c8ec7953a
Add note about using pre- and post-conditions
2019-01-17 16:02:29 -07:00
Michael Miller
ec9416285b
Add documentation to ExampleConditions
2019-01-17 15:42:58 -07:00
Michael Miller
38202ff605
Initial addition of pre- and post-conditions
2019-01-09 16:17:33 -07:00
Michael Miller
ab90f946d9
Allow "it" syntax in #given block
2019-01-09 15:08:01 -07:00
Michael Miller
17039d44f0
Initial implementation of #given macro
2019-01-09 14:58:10 -07:00
Michael Miller
950fcd250c
Add other syntaxes for #expect method
...
Can now check multiple values in the same #expect call.
Can use method short-hand syntax (&.foo) in #expect call.
2019-01-09 13:59:42 -07:00
Michael Miller
d3bf5eb4b1
Add short-hand #is and #is_not macros
...
These can be used for the one-liner "it" syntax.
2019-01-09 11:28:31 -07:00
Michael Miller
033f753dca
Initial implementation of one-liner "it" syntax
2019-01-02 13:24:30 -07:00
Michael Miller
0c3b3da2b3
Quickly implement #random_sample
by copy-pasting
...
This should be DRY'd up in the future.
2019-01-02 12:45:46 -07:00
Michael Miller
b7d3648256
Clarify that #let
can use expressions
2019-01-02 11:00:38 -07:00
Michael Miller
e6fd716586
Run around_each hooks in same context as example code
2019-01-01 17:58:54 -07:00
Michael Miller
050251b491
before_each and after_each hooks now run in example scope
...
The entire example hooks class hierarchy is no longer needed.
This is an easier implementation than originally planned.
However, this is probably slower than the other method because each hook
has to cast and check the example instance.
2019-01-01 17:51:55 -07:00
Michael Miller
aee3ead578
Revert "Pass current example to before_each and after_each hooks"
...
This reverts commit b5edb1e9f3
.
2019-01-01 17:48:07 -07:00
Michael Miller
b5edb1e9f3
Pass current example to before_each and after_each hooks
2019-01-01 16:56:23 -07:00
Michael Miller
abf7c8831c
Add getter for wrapped instance
2019-01-01 16:40:04 -07:00
Michael Miller
b53e1b60d8
Add BaseExampleHooks class
...
This is the first part in enabling before_each and after_each hooks to
access the example code's scope.
2019-01-01 16:33:07 -07:00
Michael Miller
e0273d660c
Display cause of errors
2018-12-27 15:47:29 -07:00
Michael Miller
c0be260f98
Ability to limit number of items sampled
2018-12-27 15:11:28 -07:00
Michael Miller
c1b27bb672
Rename "given" to "sample"
...
This falls in line with the `SampleValues` type.
It also frees up the keyword "given" to be used for something else.
2018-12-27 11:15:44 -07:00
Michael Miller
62549aae88
Functionality to retrieve all sample values
2018-12-13 14:30:11 -07:00
Michael Miller
c73af72c7f
Move formatter to config
2018-12-13 14:16:49 -07:00
Michael Miller
23368f6183
Structure for applying configuration
2018-12-13 13:50:59 -07:00
Michael Miller
9527427b45
Move error message output to another method
2018-12-12 15:33:54 -07:00
Michael Miller
38ec35dd29
Have the DSL builder produce a test suite
2018-12-12 15:27:40 -07:00
Michael Miller
6c5da5a703
Shuffle code around for runner
2018-12-12 15:22:56 -07:00
Michael Miller
c29748ede5
Restructuring how the test suite is driven
2018-12-12 11:48:08 -07:00
Michael Miller
6f5b03dc0f
Add top-level namespace docs
2018-12-10 16:08:25 -07:00
Michael Miller
4e0c821b8f
Add FinishedResult intermediary class
2018-12-10 14:07:14 -07:00
Michael Miller
9e004324c9
Remove shared elapsed time
...
Since PendingResult always returns zero, it's not necessary to store it.
2018-12-10 11:16:43 -07:00
Michael Miller
56e8f8978b
Detect errors in around_each
hooks
2018-12-07 23:28:30 -07:00
Michael Miller
4e57f6adca
Don't run after hooks if an error occurs
2018-12-07 23:01:02 -07:00
Michael Miller
4222603fea
Don't need reference to result anymore
2018-12-07 22:57:31 -07:00
Michael Miller
aeebbaa5b6
Raise error instead of failing test
...
If an error occurs in any hooks, raise it instead of failing the test.
2018-12-07 22:43:26 -07:00
Michael Miller
bd4d020d0f
Condense visible hook methods
2018-12-05 19:57:14 -07:00
Michael Miller
bd8df38ecd
Docs for RootExampleGroup
2018-11-23 23:54:54 -07:00
Michael Miller
fad3eba11f
Add docs for NestedExampleGroup
2018-11-20 14:04:14 -07:00
Michael Miller
c7963b70a3
Add docs for ExampleIterator
2018-11-20 11:51:47 -07:00
Michael Miller
f3feabb6e0
Reduce nesting of conditionals
2018-11-19 23:46:14 -07:00
Michael Miller
ee274dbebd
Add docs for ExampleGroup
2018-11-19 21:52:10 -07:00
Michael Miller
e79d8872ac
Cleanup indexer code
2018-11-19 19:41:51 -07:00
Michael Miller
072055d947
Change test wrapper to a struct
2018-11-17 00:14:14 -07:00
Michael Miller
d52be1ec50
Add docs for ExampleHooks
2018-11-16 13:56:43 -07:00
Michael Miller
c045305bd2
Add docs for result types
2018-11-16 09:48:35 -07:00
Michael Miller
f0204a32ea
Fix specs to work with new Expectation type
2018-11-14 02:15:55 -07:00
Michael Miller
35b59854ec
Move #eval to partial
2018-11-13 21:44:56 -07:00
Michael Miller
a3ac50d661
Update harness to match recent changes
2018-11-13 21:44:25 -07:00
Michael Miller
a66262d197
Rename ExpectationResults to ExampleExpectations
...
Update to use new Expectation type.
2018-11-13 15:59:51 -07:00
Michael Miller
b625cb69cf
Adopt partials to use new Expectation type
2018-11-13 14:17:37 -07:00
Michael Miller
718f24aef3
Adopt ValueMatcher to new Expectation type
2018-11-13 14:11:51 -07:00
Michael Miller
06ced9f799
Change Expectation to store the result
...
This removes Expectation::Result and uses Expectation and sub-types
instead.
Having two "Result" types is confusing.
2018-11-13 14:08:27 -07:00
Michael Miller
e38747eafd
Formatting
2018-11-13 10:08:56 -07:00
Michael Miller
6c882f9cae
Remove ExampleGroup#all_examples
...
Implement the same functionality with ExampleIterator.
2018-11-13 10:08:37 -07:00
Michael Miller
b5a18ad324
Implement example iterator
2018-11-13 10:06:43 -07:00
Michael Miller
0e1d87d8d4
Add docs for #it and #pending
2018-11-08 22:40:01 -07:00
Michael Miller
45230f3e67
Add docs for before, after, and around hooks
2018-11-08 13:31:50 -07:00
Michael Miller
cbfd14a88f
Add docs for #subject, #let, and #let!
2018-11-08 11:29:51 -07:00
Michael Miller
e480901cdc
Note about nested #given blocks
...
Remove unused and empty type method.
Crystal syntax doesn't allow methods where a generic type is expected.
2018-11-07 13:03:48 -07:00
Michael Miller
013f799c5e
Remove #include_examples placeholder
...
Will be re-added when it is implemented.
2018-11-07 12:58:47 -07:00
Michael Miller
3abb48fe53
Allow implicit subject to take arbitrary arguments
...
This allows easy construction of the subject when it has an initializer
with parameters.
2018-11-07 12:55:38 -07:00
Michael Miller
4e690e7906
Merge described class and implicit subject macros
...
These macros are only called once.
2018-11-07 12:53:22 -07:00
Michael Miller
665c202848
Removes #it_behaves_like placeholder
...
Will re-add this when it is implemented.
2018-11-07 12:49:10 -07:00
Michael Miller
3571d9463a
Remove #_spectator_given_collection macro
...
It is no longer needed since @type resolution isn't delayed.
2018-11-07 12:47:42 -07:00
Michael Miller
06743a181c
Move collection class out of given module
...
The collection would incorrectly have access to the `given` block's
context,
instead of just the parent context, like it should.
2018-11-07 12:33:49 -07:00
Michael Miller
69905c01f3
Add docs for #given
2018-11-07 12:26:47 -07:00
Michael Miller
bf03cf03ce
Add docs for #describe and #context
2018-11-06 14:05:41 -07:00
Michael Miller
0efaf9fa85
Formatting
2018-11-03 12:14:29 -06:00
Michael Miller
0a218b7e9f
Some initial documentation for StructureDSL
2018-11-03 12:13:53 -06:00
Michael Miller
f6d6c859e6
Add docs for example and matcher DSL
2018-11-02 20:48:36 -06:00
Michael Miller
7c21f1e3eb
Store user-friendly name of given variable
2018-11-02 18:11:46 -06:00
Michael Miller
61fe8e06d9
Change accessibility of children getter to public
2018-11-02 13:35:32 -06:00
Michael Miller
aea324a33b
Add docs for group builders and example factory
2018-10-30 16:49:01 -06:00
Michael Miller
ee4623b471
Remove redundant #add_child method
2018-10-30 16:21:19 -06:00
Michael Miller
eb8ce6ff92
Add docs to DSL and builder
2018-10-28 18:27:54 -06:00
Michael Miller
746a5da107
Dummy example shouldn't be used
2018-10-23 11:15:22 -06:00
Michael Miller
4e9cf44c2c
Add and update docs for internal module
2018-10-22 16:22:35 -06:00
Michael Miller
79392fbeff
Add note about sample value names
2018-10-22 16:22:11 -06:00
Michael Miller
152ad5a5bf
Change Entry to a private struct
2018-10-22 11:10:54 -06:00
Michael Miller
f8fa3e706d
Add #get_value method to automatically cast
2018-10-22 11:08:55 -06:00
Michael Miller
532a314441
Add methods to force failure
2018-10-19 21:09:17 -06:00
Michael Miller
686304f31d
Insert example failed exception
2018-10-19 20:58:14 -06:00
Michael Miller
9cf82928b7
Ensure harness is reset on error
2018-10-19 18:52:00 -06:00
Michael Miller
c48467f783
Slightly better wording and naming
2018-10-19 18:50:21 -06:00
Michael Miller
67e192edc6
Implement ExpectationResults specs and fix typo
2018-10-19 16:27:59 -06:00
Michael Miller
703a791f78
Formatting changes
2018-10-19 14:02:27 -06:00
Michael Miller
0892a073fe
Change Result to a class
...
This is to get around a segfault.
I'm unable to reproduce this in a simpler example at this time.
However, this can be worked around by changing from a struct to a class.
Relevant backtrace:
Invalid memory access (signal 11) at address 0x4
[0x4829f6] *CallStack::print_backtrace:Int32 +118
[0x46de7d] __crystal_sigfault_handler +61
[0x7fe6ec64b390] ???
[0x486df5] *String#==<String>:Bool +37
[0x509ac4] *Spectator::Expectations::ValueExpectationPartial(Int32) +52
[0x50a52e] *Spectator::Expectations::ValueExpectation(Int32, Int32) +94
[0x50acb2] *Spectator::Expectations::Expectation::Result +210
[0x4fcd9b] *Spectator::Expectations::ExpectationResults +635
[0x50c9eb]*Spec::ContainExpectation(Spectator::Expectations::Expectation::Result)+43
[0x4fcaea] *Spectator::Expectations::ExpectationResults +138
...
2018-10-19 13:04:51 -06:00
Michael Miller
7f4690b042
Secondary initializer for missing label
...
Label is set to actual/expected stringified value if omitted.
2018-10-18 21:52:00 -06:00
Michael Miller
9a77f8b7fd
Add specs for value expectation
...
Fix bug in expectation result actual message.
2018-10-18 17:54:43 -06:00
Michael Miller
df36331132
Workaround for Crystal compiler bug
...
See: https://github.com/crystal-lang/crystal/issues/4225
If there are no concrete implementations of a class, an "undefined
method" error is given for abstract methods.
2018-10-15 15:27:05 -06:00
Michael Miller
c77a85c97a
Flag to disable running tests
...
This is needed for testing Spectator.
2018-10-15 00:32:29 -06:00
Michael Miller
cd86687dfb
Handle negative indices
2018-10-14 19:33:38 -06:00
Michael Miller
155e9ec81a
Store example count instead of recalculating
2018-10-14 19:08:07 -06:00
Michael Miller
bcb68a5856
Implement example lookup by index
...
This will be used later for executing tests in random order.
2018-10-14 19:06:02 -06:00
Michael Miller
eade6873e4
Implement ExampleComponent#example_count
2018-10-14 18:37:54 -06:00
Michael Miller
467afd053c
Implement iterator version of ExampleGroup#each
2018-10-14 18:29:01 -06:00
Michael Miller
1a2cba79fc
Parent group can't be nil for nested group
2018-10-14 18:00:55 -06:00
Michael Miller
ab146c88c2
Bit of code cleanup
2018-10-14 17:43:33 -06:00
Michael Miller
bff6d463df
Root group builder should not inherit from nested
2018-10-14 17:40:37 -06:00
Michael Miller
30a45a24d3
Restructure to use a composite design pattern
...
Examples and example groups now have a common ancestor.
2018-10-14 17:10:12 -06:00
Michael Miller
2070d7816b
Root example group specialization
2018-10-14 14:28:05 -06:00
Michael Miller
3facf3af9d
Change "description" to "what" for consistency
2018-10-14 11:50:08 -06:00
Michael Miller
68412daec0
Remove unused code
2018-10-14 01:02:52 -06:00
Michael Miller
77f631205e
Break apart runnable example and document it
2018-10-11 10:16:48 -06:00
Michael Miller
34dce28663
Initial documentation and rework on runnable example
2018-10-10 16:57:43 -06:00
Michael Miller
81dce3df9a
Cleanup and document some example classes
2018-10-10 13:05:17 -06:00
Michael Miller
53831ab36a
Fix hook flags being nullable
2018-10-10 13:03:47 -06:00
Michael Miller
3e78f48d39
Pending examples weren't marked as finished
2018-10-09 14:53:51 -06:00
Michael Miller
d8223297af
Treat harness more like a facade
2018-10-09 14:41:22 -06:00
Michael Miller
f5317ecbd3
Rig up the harness
2018-10-09 14:25:52 -06:00
Michael Miller
bfb133f44d
Create example harness
2018-10-09 14:25:39 -06:00
Michael Miller
7b8f47f327
Implement expectation results
2018-10-08 11:25:22 -06:00
Michael Miller
c27f72c83e
Add enum for example status
2018-10-07 16:13:17 -06:00
Michael Miller
64a233a9e1
Rename ExpectationRegistry to ExpectationReporter
...
Some initial implementation for the class.
2018-10-07 13:46:51 -06:00
Michael Miller
e14babc014
ExpectationFailed exception takes a result
2018-10-07 13:45:36 -06:00
Michael Miller
73a0d51c1b
Rename message methods and add #failure?
2018-10-07 13:05:32 -06:00
Michael Miller
7277b3caaf
Display actual value if label is empty
2018-10-07 12:49:10 -06:00
Michael Miller
38da6615bf
Documentation for expectations and matchers
2018-10-07 12:42:09 -06:00
Michael Miller
d98bc05b88
Switch to structs to reduce memory allocations
2018-10-06 10:09:39 -06:00
Michael Miller
f11031f113
Upcast to fix type error
2018-10-06 09:58:58 -06:00
Michael Miller
79886e9efb
More structure around exceptions and matching
2018-10-05 16:30:19 -06:00
Michael Miller
4c2f6157af
Define some Expectation methods
2018-10-01 20:34:26 -06:00
Michael Miller
3035273e9a
Rework how expectations and matchers work together
2018-09-28 11:47:42 -06:00
Michael Miller
4948fe0c6f
Short-hand syntax for blocks with yield
2018-09-27 18:49:01 -06:00
Michael Miller
d670d96045
Remove extra assignment operations
2018-09-27 18:47:54 -06:00
Michael Miller
7484b92db9
Formatting
2018-09-27 17:50:50 -06:00
Michael Miller
b9abdb86ff
Use actual value if label is empty
...
This will show a value instead of nothing if the should-syntax is used.
2018-09-27 16:28:47 -06:00
Michael Miller
77b4c71c2a
Reduce nesting by collapsing modules with ::
2018-09-27 16:20:55 -06:00
Michael Miller
0d282d3d50
Wording - should-syntax instead of #should
2018-09-27 16:15:31 -06:00
Michael Miller
e9b8992130
Implemented should-syntax
2018-09-27 16:11:45 -06:00
Michael Miller
83a2a8e238
Manually include all sub-modules and top-level types
...
This is needed so that `spectator/should` is not included by default.
2018-09-27 15:49:34 -06:00
Michael Miller
1c9decaa41
Add documentation for top-level module
2018-09-27 15:41:18 -06:00
Michael Miller
1a61235cdc
Simplify #examples and #groups methods
2018-09-27 13:51:19 -06:00
Michael Miller
f63f8b15a0
Use label (expression string) instead of value
2018-09-24 22:58:35 -06:00
Michael Miller
371fe680c2
Pass matcher messages to failure results
2018-09-24 22:57:37 -06:00
Michael Miller
8fb051d61e
Add custom messages for matchers
...
This gives users natural, easier to understand text for expectations.
2018-09-24 22:56:48 -06:00
Michael Miller
562b544223
Capture expression string from expectations
...
This allows a string that the user had in source code instead of a resolved value.
This change requires storing a 'label' and changing expectation and matcher constructor methods to macros.
2018-09-24 22:51:26 -06:00
Michael Miller
ef7e0462cb
GivenExampleGroupBuilder produces group of groups
...
Now a group is created for each element in the collection.
A group to contain the sub-groups is returned.
2018-09-24 00:25:15 -06:00
Michael Miller
1c7c6e5e90
Initial code for example names
2018-09-23 20:24:28 -06:00
Michael Miller
5e4f0f3bbc
Initial formatting output for failures
2018-09-23 18:00:01 -06:00
Michael Miller
dcbca302dc
Fix values being wrapped twice
...
This simplifies some code.
2018-09-23 17:13:30 -06:00
Michael Miller
cf0c438a5d
Abstract away locals to SampleValues
2018-09-23 17:04:06 -06:00
Michael Miller
cddfe5591d
Move ValueWrapper and TypedValueWrapper to Internals
...
Trying to hide from top-level some inner-workings.
2018-09-23 16:23:26 -06:00
Michael Miller
887a04a92a
Remove unused classes
2018-09-23 16:13:48 -06:00
Michael Miller
7a6045a1f3
Change #it_behaves_like to a macro
2018-09-23 16:10:07 -06:00
Michael Miller
b3b8efdd59
Mark helper macros private
2018-09-23 16:07:58 -06:00
Michael Miller
70e37eeccf
DRY up DSL
2018-09-23 16:07:03 -06:00
Michael Miller
0f323666a0
Fix methods for adding hooks
2018-09-23 15:41:58 -06:00
Michael Miller
855a5f2239
Move hook storage to their own class
2018-09-23 15:26:19 -06:00
Michael Miller
57c9f2c58e
Copy/paste to reimplement pending examples
2018-09-23 14:53:32 -06:00
Michael Miller
56ae92a25d
Add symbol for getting local from #given
2018-09-23 14:45:36 -06:00
Michael Miller
3c31783fd7
Pass arguments directly onto initializer with splat
2018-09-23 14:45:14 -06:00
Michael Miller
03a8efd7f8
Create test instance when example is created
...
This exposes errors in the framework
instead of delaying them until the test runs.
2018-09-23 14:39:05 -06:00
Michael Miller
94e2f54713
Implement building groups and examples
2018-09-23 14:34:42 -06:00
Michael Miller
5b79e76b44
Use builder to get example group
2018-09-23 13:40:24 -06:00
Michael Miller
037fe604ea
Example group builder classes should build groups
...
It's implied in their name.
2018-09-23 13:40:16 -06:00
Michael Miller
d551cf6e1b
Add missing GivenExampleGroupBuilder class
2018-09-23 12:27:21 -06:00
Michael Miller
6bf07e3967
Collection for #given is now an array of ValueWrapper
2018-09-23 12:27:08 -06:00
Michael Miller
faf3bef05c
Fix typo
2018-09-23 12:21:10 -06:00
Michael Miller
fc1c0351cd
Must use class variables
2018-09-23 12:19:29 -06:00
Michael Miller
ab7087649d
Example wrappers need a top-level initializer
...
The default initializer made by the compiler takes no arguments.
Use this one to not create a default initializer.
2018-09-23 12:19:07 -06:00
Michael Miller
ecba0d00ec
Pass group to example initializer
2018-09-23 12:16:38 -06:00
Michael Miller
09184f4a2a
Group builder needs "what" as first arg
2018-09-23 12:15:53 -06:00
Michael Miller
0999cb2dbc
Use fully-qualified names
2018-09-23 12:05:19 -06:00
Michael Miller
9109fc30fd
Can pass types around (somewhat) at runtime
...
No need for extra factory classes.
2018-09-23 12:03:52 -06:00
Michael Miller
87d9cc438f
Move code for root back to Spectator#describe
...
There seems to be a problem using def in block.
This broke helper methods and gives the error: `can't declare def
dynamically`.
2018-09-23 12:02:51 -06:00
Michael Miller
9ba3fc898b
More refatoring
2018-09-22 19:41:56 -06:00
Michael Miller
a1b5533504
Some initial work to cleanup the DSL builder
2018-09-22 15:15:29 -06:00
Michael Miller
a82076e2b7
Remove type from group macros
...
This value is never directly seen,
so it isn't necessary to support it.
2018-09-22 11:38:00 -06:00
Michael Miller
110a2b2d2a
Quick exception handler for framework
...
This should be improved later.
2018-09-21 15:23:01 -06:00
Michael Miller
66ca06337d
Fix locals not being passed to child groups
2018-09-21 14:26:09 -06:00
Michael Miller
a9d4acda36
Pass locals to example and test wrapper initializer
...
The #initialize method is defined in each context/given/module
that needs to add a local.
This is an elegant (although possibly confusing) solution.
2018-09-21 14:03:09 -06:00
Michael Miller
cba0abc7f1
Fixes for enumerating examples
2018-09-20 18:41:36 -06:00
Michael Miller
39be62c511
Temp disable until I figure out how to reference wrapped example
2018-09-20 18:41:21 -06:00
Michael Miller
007572f0b8
Get rid of #add_examples
...
Added #example_count method to help with array sizing.
2018-09-19 23:13:43 -06:00
Michael Miller
8b8981494d
Trying to get exaples to map to their given values
2018-09-19 23:00:17 -06:00
Michael Miller
aaf973b8cf
Concat #all_examples instead of recursive #add_examples
2018-09-19 22:28:20 -06:00
Michael Miller
4d601281f6
Delay example creation by using factories
...
The #given block functionality specifically needs this to create
multiple examples.
2018-09-19 21:58:32 -06:00
Michael Miller
bb7f036a82
Make Example#group abstract
...
Instead of passing parent group as an argument, define the group method
in the exapmle class created by the #it macro.
2018-09-19 21:50:51 -06:00
Michael Miller
0f7640411f
Use symbols instead of strings for hash lookups
2018-09-19 21:06:10 -06:00
Michael Miller
a28f512ae4
Some code for repeating examples in given blocks
2018-09-19 20:49:01 -06:00
Michael Miller
830aa7b43a
Structural code for enumerating given value sets
2018-09-19 20:00:26 -06:00
Michael Miller
2be9d65997
Add examples to group children
2018-09-19 19:32:59 -06:00
Michael Miller
06630e87d3
Rework how children are handled
...
Uses a loose version of the composite pattern.
This is to keep examples in the order they were declared.
2018-09-19 19:31:50 -06:00
Michael Miller
d679c356fd
Move conditional into context macro
2018-09-19 19:29:33 -06:00
Michael Miller
fe81341e1a
Rename MAPPING to GROUPS - better name
2018-09-19 18:58:44 -06:00
Michael Miller
41c0d9abc7
Initial changes for DSL refactor
...
No examples are picked up right now.
2018-09-19 18:53:09 -06:00
Michael Miller
fa73bf3a60
Hide method to infer type of first in collection in given macro
...
This was a bit of a hack.
2018-09-15 23:38:07 -06:00
Michael Miller
80fbe89b4c
Track children in DSL
2018-09-15 16:58:59 -06:00
Michael Miller
a06ea6088c
Shorten GroupDefinitions to Definitions
2018-09-15 16:53:28 -06:00
Michael Miller
196187a98a
Add human-friendly formatting to runtime
2018-09-15 15:45:17 -06:00
Michael Miller
d1527d8c0d
Change char for pending to *
2018-09-15 14:16:10 -06:00
Michael Miller
fd547c5814
Use Time::Span.zero instead of constructor with 0 nanoseconds
2018-09-15 14:10:59 -06:00
Michael Miller
caeab6c338
Cleanup color code
2018-09-15 14:04:17 -06:00
Michael Miller
625262b6d5
Colorize result string based on outcome
2018-09-15 13:51:28 -06:00
Michael Miller
8e1a2e114b
Display summary from default formatter
2018-09-15 13:51:07 -06:00
Michael Miller
b329afffb6
Rename Report to TestResults
2018-09-15 13:31:55 -06:00
Michael Miller
ac53394b8d
Additional methods to describe result
2018-09-15 13:30:07 -06:00
Michael Miller
5819e0201e
Shorten names of result classes
2018-09-15 13:25:11 -06:00
Michael Miller
6ca4d8d2a6
Move matchers DSL into their own module
...
Moves the #eq method out of the global namespace.
2018-09-15 11:58:43 -06:00
Michael Miller
1ea06998e7
Move #expect from global namespace to example DSL
2018-09-15 11:30:45 -06:00
Michael Miller
967797428c
Move DSL to its own directory
2018-09-15 11:21:23 -06:00
Michael Miller
b5cdda4af3
Shorten ExpectationFailedError to ExpectationFailed
2018-09-15 11:05:11 -06:00
Michael Miller
a1871ca62e
Rename StandardFormatter to DefaultFormatter
2018-09-15 10:57:49 -06:00
Michael Miller
cfe1a014dd
Rename reporters to formatters
2018-09-15 10:56:58 -06:00
Michael Miller
251bf5bb5e
Remove unused source type
2018-09-15 10:53:00 -06:00
Michael Miller
a3366add13
Cleanup remaining references to "context" that should be "group"
2018-09-15 10:52:17 -06:00
Michael Miller
010b47ca1f
Rename ContextDefinitions to GroupDefinitions
2018-09-15 10:49:46 -06:00
Michael Miller
7968c5a394
Rename Context to ExampleGroup
2018-09-15 10:45:47 -06:00
Michael Miller
dc8e651209
Quick implementation of pending examles
2018-09-15 10:36:20 -06:00
Michael Miller
56229cdc93
Move common example runner code into new RunnableExample class
2018-09-14 22:17:16 -06:00
Michael Miller
e4d46ca603
Initial implementation of invoking #around_each hooks
...
My brain hurts. 😖
2018-09-13 10:44:21 -06:00
Michael Miller
9f778c5cb9
Fix after_all hooks running too soon
2018-09-12 21:31:44 -06:00
Michael Miller
77753ab974
Move hook execution into Example#run
2018-09-12 20:42:39 -06:00
Michael Miller
5b275f3146
Use #unsafe_as
...
The value can't be any other type, so this should be a safe operation.
2018-09-12 20:28:36 -06:00
Michael Miller
fbea3533ea
Remove setter and extra code for given vars
2018-09-12 20:27:11 -06:00
Michael Miller
e30da2be19
Some macro cleanup
2018-09-12 19:23:27 -06:00
Michael Miller
9b07f669ed
Remove Locals sub-module
...
This allows for seamless helper methods.
2018-09-12 19:16:41 -06:00
Michael Miller
3fc625de3f
Allow generic types for #described_class and implicit #subject
...
Add runtime check to ensure #described_class is a type name.
2018-09-12 18:54:46 -06:00
Michael Miller
037612d00a
Add implicit subject
2018-09-12 18:37:33 -06:00
Michael Miller
8cf876268a
Use fresh variables
2018-09-12 16:29:48 -06:00
Michael Miller
10fc6c6a35
Hide special character mapping
2018-09-12 15:54:45 -06:00
Michael Miller
625a331745
Initial code to indirectly run example
...
This issolates the example code from the example class' attributes, such
as #description, #run, and others.
2018-09-12 15:47:57 -06:00
Michael Miller
700108f52f
Move example-specific DSL to its own module
2018-09-12 15:41:23 -06:00
Michael Miller
4bfd2b9620
Rearrange DSL
2018-09-12 15:21:23 -06:00
Michael Miller
e451c027a8
Fix bad copy/paste for hooks
2018-09-12 15:16:18 -06:00
Michael Miller
193314d532
Fix given variables being defined in parent context
2018-09-12 15:13:46 -06:00
Michael Miller
8b55d9139d
Hide constants used to build test hiearchy
2018-09-12 14:53:11 -06:00
Michael Miller
c2ee9fd520
Move ROOT_CONTEXT out of Spectator module
2018-09-11 20:25:28 -06:00
Michael Miller
6f6ba9c812
Obscure given value setter
2018-09-11 16:19:31 -06:00
Michael Miller
65e8ee3788
Fix string descriptions having extra quotes
2018-09-11 16:01:31 -06:00
Michael Miller
84ed9c41b2
Store example description
2018-09-11 15:57:18 -06:00
Michael Miller
d8621fc43e
Store "what" string in context
2018-09-11 15:54:00 -06:00
Michael Miller
284e10482a
Add names for most common special characters
...
These names will be used instead of an underscore. This helps with
naming.
2018-09-11 15:09:23 -06:00
Michael Miller
95ec999bba
Hide name of underlying let's block method
...
This prevent's defining a bang version of the let value with the same
name.
2018-09-11 12:54:47 -06:00
Michael Miller
2c0238d178
Invoke before_each, before_all, after_each, and after_all hooks
2018-09-10 22:33:40 -06:00
Michael Miller
a725c0d5be
Pass context to examples
2018-09-10 21:51:14 -06:00
Michael Miller
2ff8ebb3cb
Implement creation of hooks
2018-09-10 21:27:24 -06:00
Michael Miller
387e129a89
Add context instances
2018-09-10 19:59:57 -06:00
Michael Miller
65da494e52
Fix for no block arg in #given - "value" treated as StringLiteral
2018-09-10 19:28:57 -06:00
Michael Miller
b1d44fb480
Remove source tracking since it doesn't work right with macros
2018-09-07 21:49:46 -06:00
Michael Miller
aa1764d972
Cleanup contextual arguments
2018-09-07 18:20:54 -06:00
Michael Miller
27e3f00d70
Remove RunOrder
...
Examples will be sorted by using the decorator pattern.The collection of
examples will be wrapped when a custom run order isused.
2018-09-07 15:06:57 -06:00
Michael Miller
cb0ae516ae
Catch duplicate given blocks with same variable name
2018-09-06 22:39:40 -06:00
Michael Miller
5646a6ebd9
Remove unecessary underscores
2018-09-06 22:23:57 -06:00
Michael Miller
45261c419f
Super hacky way to resolve type of given variables
2018-09-06 22:08:32 -06:00
Michael Miller
7c8be54e5c
Mostly complete code for #given
2018-09-06 21:13:03 -06:00
Michael Miller
3e7f43009f
Use more correct name for constant
2018-09-06 19:22:47 -06:00
Michael Miller
f7eeb2b2a3
Implement #described_class
2018-09-04 16:59:59 -06:00
Michael Miller
7ff91b4fc6
Rename "context" to "locals"
...
Remove possible confusion around variables (let and subject) and context
keyword.
2018-09-04 16:17:33 -06:00
Michael Miller
de55e31407
Add basics for tracking source code location
2018-09-04 13:36:19 -06:00
Michael Miller
b8dcf35165
Add report for suite results
2018-08-30 23:38:20 -06:00
Michael Miller
9d39bc80b1
Fix filename
2018-08-30 23:24:49 -06:00
Michael Miller
792bca99e5
Simplify rescue
2018-08-30 22:50:27 -06:00
Michael Miller
fb4dd9fd22
Fix default run order
2018-08-30 22:47:40 -06:00
Michael Miller
f4de0ffee9
Capture elapsed test time
2018-08-30 22:45:49 -06:00
Michael Miller
e38fddb12a
Initial code for reporters
2018-08-30 22:21:10 -06:00
Michael Miller
aba9f50d58
Remove unused results
2018-08-30 21:57:44 -06:00
Michael Miller
9fb1a3b664
Add base classes for defining example run order
2018-08-30 21:32:13 -06:00
Michael Miller
c100651680
Handle errored and failing specs separately
...
An errored example is one that throws an exception that is not from an
expectation failing.
2018-08-30 21:15:20 -06:00