Commit graph

530 commits

Author SHA1 Message Date
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
8297152c36 Mark truthy matchers as complete 2019-01-23 16:08:41 -07:00
Michael Miller
3d4d8f67be Document truthy flag 2019-01-23 16:07:26 -07:00
Michael Miller
95b0563f73 Add spec for TruthyMatcher 2019-01-23 16:06:18 -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
41729217bb Add tests for pre- and post-conditions in groups 2019-01-23 15:12:09 -07:00
Michael Miller
37c45eb285 Shorten pre and post usage 2019-01-23 14:46:15 -07:00
Michael Miller
ed8fad2c97 Add documentation for pre- and post-conditions 2019-01-23 14:37:43 -07:00
Michael Miller
a32b511e0b Add spec for match (regex) matcher 2019-01-19 14:49:13 -07:00
Michael Miller
260e1884ab Implement match (regex) matcher 2019-01-19 14:40:14 -07:00
Michael Miller
19da933c2f Add spec for be_a matcher 2019-01-19 14:29:07 -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
f2569ea3a0 Add spec for be matcher 2019-01-19 13:50:57 -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
db89a99562 Add specs for ExampleConditions 2019-01-17 14:14:10 -07:00
Michael Miller
d9363fc8a7 Update existing specs to support conditions 2019-01-11 10:09:40 -07:00
Michael Miller
38202ff605 Initial addition of pre- and post-conditions 2019-01-09 16:17:33 -07:00
Michael Miller
6caf5353e0 Update README
One-liner and #given DSL are implemented.
2019-01-09 15:10:57 -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
7f99dcc06f Add item for pre- and post-conditions 2019-01-01 18:00:24 -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
191eb02cbe Add dummy instance values 2019-01-01 17:06:24 -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