Commit graph

50 commits

Author SHA1 Message Date
Michael Miller
3a5dd76324
Remove ExampleBase
Pending/skip functionality will be merged into Example or extend from 
it.
2020-09-05 19:54:55 -06:00
Michael Miller
4debebb8f0
Formatting 2020-09-05 15:55:28 -06:00
Michael Miller
55900ebecd
Initial rework of example type structure 2020-09-05 15:01:22 -06:00
Michael Miller
88ed415191 Bubble up matcher description
The last run matcher's description is used if one wasn't provided by the 
user.
Only applies to examples that actually run and have expectations.
2020-01-02 19:19:55 -07:00
Michael Miller
ff2cbcd4c7 Allow test description to be blank
Currently defaults to the example's source.
2020-01-02 18:40:25 -07:00
Michael Miller
25778d7b41 Change "what" to "description" 2019-09-26 16:49:44 -06:00
Michael Miller
a355b59f3e Type annotations for return types 2019-09-25 09:12:03 -06:00
Michael Miller
d4e890af4c Merge remote-tracking branch 'origin/master' into example-restructure 2019-09-23 21:30:12 -06:00
Michael Miller
43dc106c18 Add return type annotations
Addresses Crystal compiler warning about abstract method return types.
2019-09-23 20:32:21 -06:00
Michael Miller
24ccb77595 Expose running example to before-each and after-each hooks 2019-09-22 11:27:18 -06:00
Michael Miller
08ee03b1de Quickly get things somewhat working again 2019-09-12 20:16:41 -06:00
Michael Miller
64166d1c36 Some fixes 2019-09-11 22:21:06 -06:00
Michael Miller
a100191875 Merge branch 'example-restructure' of gitlab.com:arctic-fox/spectator into example-restructure 2019-09-08 11:02:02 -06:00
Michael Miller
a178db05ac Use TestWrapper in Example classes 2019-09-08 10:38:26 -06:00
Michael Miller
0706a9986c Ensure example is set to finished after running 2019-09-06 13:08:41 -06:00
Michael Miller
bfe641e07e Move sample values to group instance
The goal is to construct examples with a parameterless initializer.
This doesn't quite work, since the sample values are retrieved via the
harness, which doesn't have an active example when the sample values are
created.
2019-08-30 14:46:24 -06:00
Michael Miller
a3c1892465 Move example filters from === to their own types 2019-03-25 10:51:50 -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
09b6dee004 Move the remaining to_json methods to their own types 2019-03-22 21:29:20 -06: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
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
ed01a95e67 Replace source file and line with source struct 2019-02-17 12:40:16 -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
abf7c8831c Add getter for wrapped instance 2019-01-01 16:40:04 -07:00
Michael Miller
c48467f783 Slightly better wording and naming 2018-10-19 18:50:21 -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
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
3facf3af9d Change "description" to "what" for consistency 2018-10-14 11:50:08 -06:00
Michael Miller
81dce3df9a Cleanup and document some example classes 2018-10-10 13:05:17 -06:00
Michael Miller
1c7c6e5e90 Initial code for example names 2018-09-23 20:24:28 -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
ecba0d00ec Pass group to example initializer 2018-09-23 12:16:38 -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
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
5819e0201e Shorten names of result classes 2018-09-15 13:25:11 -06:00
Michael Miller
251bf5bb5e Remove unused source type 2018-09-15 10:53:00 -06:00
Michael Miller
7968c5a394 Rename Context to ExampleGroup 2018-09-15 10:45:47 -06:00
Michael Miller
56229cdc93 Move common example runner code into new RunnableExample class 2018-09-14 22:17:16 -06:00
Michael Miller
9f778c5cb9 Fix after_all hooks running too soon 2018-09-12 21:31:44 -06:00
Michael Miller
700108f52f Move example-specific DSL to its own module 2018-09-12 15:41:23 -06:00
Michael Miller
84ed9c41b2 Store example description 2018-09-11 15:57:18 -06:00
Michael Miller
a725c0d5be Pass context to examples 2018-09-10 21:51:14 -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
de55e31407 Add basics for tracking source code location 2018-09-04 13:36:19 -06:00
Michael Miller
aeb09b4e0d The #is_expected macro must be in example for visibility in #it 2018-08-28 16:44:21 -06:00
Michael Miller
b90cc39638 Playing around with contexts and examples 2018-08-24 14:53:14 -06:00
Michael Miller
74905b82bd Minimal handling of expectations and failures 2018-08-23 12:44:40 -06:00
Michael Miller
0613344230 Scratch work on structure 2018-08-19 01:15:32 -06:00