Commit graph

1070 commits

Author SHA1 Message Date
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
00b7e15915 README improvements 2018-09-27 15:02:50 -06:00
Michael Miller
61c5505fb5 Update main description 2018-09-27 14:57:58 -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