Commit graph

837 commits

Author SHA1 Message Date
Michael Miller
dd943c9046 Fix botched copy-paste 2019-04-06 12:42:08 -06:00
Michael Miller
659174c66a Add placeholder negate method 2019-04-06 12:41:38 -06:00
Michael Miller
12c71a25cd Merge branch 'master' of gitlab.com:arctic-fox/spectator 2019-04-05 23:53:55 -06:00
Michael Miller
9650d7f9c1 Use inspect on values in to_s
The to_json method calls to_s, which results in incorrect output.
2019-04-05 23:13:23 -06:00
Michael Miller
53de72805b Add skip macro as alternative to pending 2019-04-05 20:07:04 -06:00
Michael Miller
c18d9c4ffd Allow top-level context macro 2019-04-05 18:38:57 -06:00
Michael Miller
7a0e28945a Merge branch 'master' of gitlab.com:arctic-fox/spectator 2019-04-03 18:20:24 -06:00
Michael Miller
31a2bbcebb random_sample should use Spectator's global random 2019-04-02 22:22:40 -06:00
Michael Miller
675ef60f9d Consistent version 2019-04-02 22:05:27 -06:00
Michael Miller
157fdb813c Fix doc regarding hook execution order 2019-04-02 19:46:32 -06:00
Michael Miller
fef8715ce1 Allow it, pending, and xit to omit what 2019-03-31 20:56:08 -06:00
Michael Miller
58031e01c6 Missed a usage of yield that should be block 2019-03-31 18:53:40 -06:00
Michael Miller
60f50b6378 Add ability to name subjects 2019-03-31 12:53:00 -06:00
Michael Miller
785f2ef2dd Missing doc 2019-03-30 18:38:06 -06:00
Michael Miller
27ec27a3f3 Add array matcher 2019-03-30 18:38:06 -06:00
Michael Miller
cd60fae157 Add respond_to matcher 2019-03-28 23:20:32 -06:00
Michael Miller
e87314be58 Use block instead of yield to insert block
The "yield" method produces `begin...end`.
The "block" method produces `do...end`, which is needed for this syntax.
2019-03-26 21:45:31 -06:00
Michael Miller
2da1f9dbbf Missed one 2019-03-26 18:05:08 -06:00
Michael Miller
007c0c7950 Fix "missing" variables caused by wrong macro syntax 2019-03-26 17:59:15 -06:00
Michael Miller
44e681ae79 Change JSON timing values to seconds as a float 2019-03-25 16:56:38 -06:00
Michael Miller
4eb8eadd9e Add profile info to JSON output 2019-03-25 16:54:27 -06:00
Michael Miller
df6431f2d7 Add profile summary to TAP output 2019-03-25 16:49:57 -06:00
Michael Miller
291a927f1e Add profile information to suite summary 2019-03-25 16:44:20 -06:00
Michael Miller
34b0399654 Use example_runtime instead of total runtime
This fixes the issue where < 10 examples in profile showed less than 
100% total time.
2019-03-25 16:31:01 -06:00
Michael Miller
72aa72781a Move human time to its own type to share it 2019-03-25 16:15:00 -06:00
Michael Miller
aabc25ad4f Change formatters to take nillable profile 2019-03-25 16:05:38 -06:00
Michael Miller
6dd4c4bc2f Add Profile class 2019-03-25 15:54:51 -06:00
Michael Miller
a02e2ff701 Add profile config option 2019-03-25 12:26:45 -06:00
Michael Miller
35b887f8f0 Add placeholders for profile functionality 2019-03-25 12:13:11 -06:00
Michael Miller
2d88097c04 Re-implement filters in command-line arguments 2019-03-25 11:39:27 -06:00
Michael Miller
2ff9505766 Add filter to TestSuite 2019-03-25 11:35:39 -06:00
Michael Miller
49c396714e Revert 29279e1
Update Runner to not use Iterable#each
2019-03-25 11:29:20 -06:00
Michael Miller
3654b2473b Add example filter to config 2019-03-25 11:17:53 -06:00
Michael Miller
d1767ebb7a Add CompositeExampleFilter 2019-03-25 11:10:27 -06:00
Michael Miller
481319c097 Add NullExampleFilter 2019-03-25 10:58:49 -06:00
Michael Miller
a3c1892465 Move example filters from === to their own types 2019-03-25 10:51:50 -06:00
Michael Miller
b2ab579d8a Remove --pattern option
This can be handled by calling `crystal spec`.
2019-03-25 10:51:20 -06:00
Michael Miller
3787d4fc28 Cleanup cli arguments by breaking apart parser.on calls 2019-03-25 09:41:36 -06:00
Michael Miller
bf2c62b7e8 Initial work on filter criteria 2019-03-23 22:38:44 -06:00
Michael Miller
8c66f8df34 Add ExampleFilter class 2019-03-23 22:03:49 -06:00
Michael Miller
2f8b4761de Make Example comparable against names and sources
This will be needed for filtering examples.
2019-03-23 21:40:13 -06:00
Michael Miller
4f3ca20741 Parse source strings 2019-03-23 20:47:41 -06:00
Michael Miller
268db53bf8 Use more sensible label for non-labeled procs 2019-03-23 20:23:31 -06:00
Michael Miller
ac85fac968 Unprotect build method 2019-03-23 20:22:09 -06:00
Michael Miller
d04db7bf68 Add specialized should/should_not methods for procs 2019-03-23 20:20:15 -06:00
Michael Miller
102105911c Fix "should" syntax 2019-03-23 20:15:35 -06:00
Michael Miller
ebfec8058e Hide getters from external types 2019-03-23 20:01:42 -06:00
Michael Miller
bc8b608789 Perform in-place shuffle 2019-03-23 19:58:45 -06:00
Michael Miller
7b1b65f553 Implement --order flag to match RSpec 2019-03-23 19:56:00 -06:00
Michael Miller
b6453d135a Implement random test order execution 2019-03-23 19:43:41 -06:00
Michael Miller
29279e1812 Implement Iterable 2019-03-23 19:42:32 -06:00
Michael Miller
d0ba2c5400 Config stores the RNG instead of a seed 2019-03-23 19:42:19 -06:00
Michael Miller
21a0f78219 Implement random generator and seed 2019-03-23 19:18:29 -06:00
Michael Miller
5d95e1b5dd Save built-up config 2019-03-23 18:35:15 -06:00
Michael Miller
57271d5f4b Implement --no-color option 2019-03-23 18:24:11 -06:00
Michael Miller
a7d8d35a06 Implement option for JUnit test output 2019-03-23 17:01:03 -06:00
Michael Miller
ef8b773787 Support multiple formatters at once 2019-03-23 17:00:21 -06:00
Michael Miller
f1873238cd Add expectation values to failure 2019-03-23 16:42:53 -06:00
Michael Miller
50929c6666 Use standard status text 2019-03-23 16:34:54 -06:00
Michael Miller
ff20fbe232 Cleanup top-level formatting code 2019-03-23 16:28:36 -06:00
Michael Miller
3fbe6a2760 Implement Java naming 2019-03-23 16:27:51 -06:00
Michael Miller
93368503e6 Cleanup JUnit test case hierarchy 2019-03-23 16:07:40 -06:00
Michael Miller
3776cd917e Initial code for JUnit output 2019-03-23 15:31:53 -06:00
Michael Miller
4890cafefa Ability to enumerate each result in report 2019-03-23 14:44:00 -06:00
Michael Miller
4d38bf3ab2 Add secondary initializer 2019-03-23 14:38:51 -06:00
Michael Miller
edbcff03a5 Implement TAP formatter 2019-03-23 00:25:46 -06:00
Michael Miller
29dc833ea3 Add report stats, timing, and result 2019-03-22 21:48:00 -06:00
Michael Miller
dca2925461 Simplify to_json calls 2019-03-22 21:43:33 -06:00
Michael Miller
09b6dee004 Move the remaining to_json methods to their own types 2019-03-22 21:29:20 -06:00
Michael Miller
b12c1aba96 Move to_json builder methods into result classes 2019-03-22 21:23:14 -06:00
Michael Miller
c869e4fc9a Add to_s methods for result types 2019-03-22 20:12:36 -06:00
Michael Miller
82a4a15ba9 Initial work on JSON formatter 2019-03-22 20:11:58 -06:00
Michael Miller
ba0453c5ea Implement dry-run mode 2019-03-22 14:18:03 -06:00
Michael Miller
435f971c87 Add dry-run to config 2019-03-22 14:05:48 -06:00
Michael Miller
46e3246c5c Fix new lines with pending tests 2019-03-22 14:00:58 -06:00
Michael Miller
acfe9d2808 Conditionally remove blank lines 2019-03-22 13:53:06 -06:00
Michael Miller
caf19ffbd8 Formatting 2019-03-22 13:49:37 -06:00
Michael Miller
748b0223af Adjust output formatting for fail-blank mode 2019-03-22 13:48:47 -06:00
Michael Miller
209ef92d3d Implement "fail-blank" into runner and report 2019-03-22 13:41:46 -06:00
Michael Miller
165178237c Add dummy match data
Apparently the abstract bug pops up again when there are no tests.
2019-03-22 13:34:44 -06:00
Michael Miller
31d58fea25 Add "fail-blank" config option 2019-03-22 13:21:37 -06:00
Michael Miller
d22b628526 Stub remaining options from Crystal's default Spec 2019-03-22 13:15:17 -06:00
Michael Miller
a57e596a62 Add -h flag to show help 2019-03-22 13:08:32 -06:00
Michael Miller
66ac2eb080 Missing space between prefix and value 2019-03-22 13:03:33 -06:00
Michael Miller
c197f3236f Actual values should not be prefixed 2019-03-22 13:01:55 -06:00
Michael Miller
e7e1d0e084 Change how values are passed to helper
Working around a segfault (dunno why this fixes it).
2019-03-22 11:53:20 -06:00
Michael Miller
d705ef657c Update specs to handle new match data values 2019-03-22 11:41:39 -06:00
Michael Miller
31acc707dc Fix stringified inspection of generic match data value 2019-03-22 11:04:11 -06:00
Michael Miller
5e80b3835a MatchDataValue must be a class
Negatable value modifiers don't get updated when they're structs.
2019-03-22 11:01:47 -06:00
Michael Miller
a19d9f00aa Update formatters to handle new labeled values 2019-03-22 11:00:00 -06:00
Michael Miller
92b407380b Fix negation of values in Expectation 2019-03-22 10:57:53 -06:00
Michael Miller
33841e8888 Sub-type value modifier from MatchDataValue
This includes renaming the types.
2019-03-22 10:55:57 -06:00
Michael Miller
4f6309a032 Rename values to named_tuple in match data types 2019-03-22 10:41:23 -06:00
Michael Miller
8d3ab0d44c Transform named tuple match data to array
Trying to keep some of the existing code (and better syntax).
2019-03-22 10:38:09 -06:00
Michael Miller
66bd1555ac Use Symbol instead of String 2019-03-22 10:35:43 -06:00
Michael Miller
0b467012cb Initial work on match data values management 2019-03-22 10:30:03 -06:00
Michael Miller
dba047e1ec Formatting 2019-03-22 00:16:09 -06:00
Michael Miller
a804907f75 Add text to output for fail-fast 2019-03-22 00:14:36 -06:00
Michael Miller
a31d5c8b5b Implement fail-fast in runner
Report tracks number of omitted tests due to abort.
2019-03-22 00:05:53 -06:00
Michael Miller
9e63c20df2 Add fail-fast to config 2019-03-21 23:40:00 -06:00
Michael Miller
fe81586527 Pass builder instead of individual arguments
Config members will get large.
Preventing a large amount of arguments in advance.
2019-03-21 23:03:13 -06:00
Michael Miller
244947a81d Wrap stringified block with back-ticks 2019-03-21 21:21:05 -06:00
Michael Miller
4a887bb906 Add DSL for expect_raises 2019-03-21 21:18:36 -06:00
Michael Miller
f3ef2e561e Initial implementation of raise_error matcher 2019-03-21 21:10:16 -06:00
Michael Miller
72ccafb8b7 Pass subject to proc via partial 2019-03-21 21:09:46 -06:00
Michael Miller
e552cbffd2 Fix DSL usage of BlockExpectationPartial 2019-03-19 21:20:23 -06:00
Michael Miller
33e3b5a811 Use {{yield}} only in methods
The {{yield}} expression wraps the block with "begin ... end".
For some reason classes and modules can be defined in a "begin ... end"
block, but that might change.
2019-03-10 06:42:51 -06:00
Michael Miller
0ca0ba0a55 Fix tests to account for negation wrappers 2019-03-07 16:12:23 -07:00
Michael Miller
37f2ce99a3 Simplify negated usage and expose value 2019-03-07 15:34:55 -07:00
Michael Miller
ee7a91c3dd Add negation wrappers
Fixes the reported expected values when the expectation is negated.
2019-03-06 21:39:28 -07:00
Michael Miller
018e3232cd Update RangeMatcher to use MatchData
There is a compilation error.
It appears that since the last Matcher#match method has been
implemented,
Crystal is finally grouping all of the NamedTuples together.
2019-03-06 15:01:00 -07:00
Michael Miller
acf52e1553 Pass through prefixed value #inspect method 2019-03-06 14:30:46 -07:00
Michael Miller
fbee1d9461 Update RegexMatcher to use MatchData 2019-03-06 13:10:16 -07:00
Michael Miller
f29aba42d2 Update TruthyMatcher to use MatchData 2019-03-06 13:04:18 -07:00
Michael Miller
5fd1547ced Fix verbage around failure message 2019-03-06 12:01:32 -07:00
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