Commit graph

1483 commits

Author SHA1 Message Date
matthewmcgarvey
5bd911341b Set end_line equal to line if end_line not provided 2021-03-30 15:29:51 -04:00
matthewmcgarvey
8fafd2467d Allow matching any line number of example in filter 2021-03-30 00:18:08 -04:00
Michael Miller
74b78b7ca8
Rename Source to Location 2021-02-12 22:46:22 -07:00
Michael Miller
08451df643
Add matcher to check compiled type of values 2021-02-12 18:33:50 -07:00
Michael Miller
3083f82132
Change DSL::Values to DSL::Memoize 2021-02-10 17:07:49 -07:00
Michael Miller
3cd569e639
Prevent using reserved keywords in let and subject 2021-02-10 16:58:17 -07:00
Michael Miller
86a85c0946
Missed a method that should be private 2021-02-09 23:27:00 -07:00
Michael Miller
8b5fd099bb
More docs 2021-02-09 22:50:09 -07:00
Michael Miller
8232da1167
Mark DSL generated methods as private 2021-02-09 22:40:15 -07:00
Michael Miller
7a5f7adfc2
Change Anything to only use case equality 2021-02-09 21:18:20 -07:00
Michael Miller
a20f2d4f98
Test and improve "Anything" 2021-02-09 19:10:11 -07:00
Michael Miller
e0c4d2ac3e
Bump version to 0.9.32 2021-02-03 10:08:46 -07:00
Michael Miller
8d48e441b2
Fix generating source from brace-less examples.
Addresses https://github.com/icy-arctic-fox/spectator/issues/20
2021-02-03 10:06:00 -07:00
Michael Miller
0363c43dff
Fix described_class
Must be a macro, otherwise the return type becomes a union of all nested 
described_class methods, which can cause weird errors.
2021-01-31 00:38:17 -07:00
Michael Miller
a20b7cad80
Workaround for case where wrapper might store a type 2021-01-30 23:49:20 -07:00
Michael Miller
e275711f2b
Formatting 2021-01-30 23:48:59 -07:00
Michael Miller
ff49c674c6
Fix around_each hook ordering when at the same level 2021-01-30 21:15:20 -07:00
Michael Miller
0f44403053
Fix namespaces preventing structs from being mocked 2021-01-30 21:11:51 -07:00
Michael Miller
0332b6eb3b
Log when deferred operations run 2021-01-30 21:07:42 -07:00
Michael Miller
292dfcbe29
Ignore nameless groups in document hierarchy 2021-01-30 21:00:28 -07:00
Michael Miller
e44505d4c1
Set nameless example to matcher description 2021-01-30 21:00:01 -07:00
Michael Miller
82e13f5434
Sloppily handle deferred operations 2021-01-30 20:53:09 -07:00
Michael Miller
078058ad05
Fix various issues with subjects
All tests in crystal spec pass!
2021-01-30 20:38:09 -07:00
Michael Miller
948e29a8b7
Fix short-hand should syntax 2021-01-30 20:27:36 -07:00
Michael Miller
62d478f7c2
Prevent overly verbose output of internals 2021-01-30 20:20:30 -07:00
Michael Miller
228696c8b0
Fix exit code when tests fail 2021-01-30 20:11:09 -07:00
Michael Miller
9743f37e5c
Capture reported expectations 2021-01-30 20:07:45 -07:00
Michael Miller
bda554739c
Re-add JSON output for some types 2021-01-30 20:07:36 -07:00
Michael Miller
9d139dfeed
Hack together result output 2021-01-30 19:42:46 -07:00
Michael Miller
17a3f27029
Address Ameba errors 2021-01-30 18:57:29 -07:00
Michael Miller
e8b284fc60
Fix namepsaces
crystal spec compiles again!
2021-01-30 17:40:33 -07:00
Michael Miller
b6335ab4bc
Update includes list 2021-01-30 17:40:03 -07:00
Michael Miller
d3ad0963cd
Minor fixes 2021-01-30 17:31:50 -07:00
Michael Miller
b07dca697e
Remove seemingly unused context stubs code 2021-01-30 17:27:17 -07:00
Michael Miller
3b5086c74b
Re-add mocks to harness 2021-01-30 17:27:02 -07:00
Michael Miller
73985772b7
DSL fully added back in 2021-01-30 16:43:13 -07:00
Michael Miller
d43d309a47
Note about tag inheritence 2021-01-30 16:39:41 -07:00
Michael Miller
3bc567da4c
Skip examples marked pending 2021-01-30 16:36:15 -07:00
Michael Miller
2301e44bd1
Add pending? method 2021-01-30 16:05:32 -07:00
Michael Miller
20680f37cb
Add docs 2021-01-30 15:39:29 -07:00
Michael Miller
ba967218fa
Move tags code to a common location 2021-01-30 15:34:17 -07:00
Michael Miller
bd942bb644
Shorten tag method names
Plain `tags` is safe to use as a class method on the group.
2021-01-30 14:13:27 -07:00
Michael Miller
e093ec788e
Clean up tags method generation by moving it to another macro 2021-01-30 14:08:42 -07:00
Michael Miller
803a09464d
Initial work to pass along pre-set tags
Define pending examples and groups using this method.
2021-01-30 12:32:13 -07:00
Michael Miller
de779fdf61
Remove unecessary type name 2021-01-30 12:26:29 -07:00
Michael Miller
fdc2a71dd5
Formatting 2021-01-30 12:07:45 -07:00
Michael Miller
c5246e1cd3
Promote Tags to the Spectator namespace 2021-01-30 12:07:23 -07:00
Michael Miller
db877da984
Change tags to symbols 2021-01-30 12:03:38 -07:00
Michael Miller
5166cd7778
Fix case with no tags and some metadata
Simplify tag set construction code.
2021-01-30 12:01:49 -07:00
Michael Miller
467f0d3ad4
Pass along tags 2021-01-30 11:34:01 -07:00
Michael Miller
e77d6f0a4f
Change groups from metadata to tags 2021-01-30 11:21:49 -07:00
Michael Miller
71a497b148
Move tags to node level 2021-01-30 11:20:20 -07:00
Michael Miller
8cf498c9e9
Switch to using tags instead of metadata 2021-01-30 11:13:30 -07:00
Michael Miller
11cb16fb3a
Add missing call to super 2021-01-30 10:14:09 -07:00
Michael Miller
a56b1e0eb1
Somewhat functional metadata unwrap 2021-01-30 01:16:26 -07:00
Michael Miller
466a388558
Initial code for example metadata 2021-01-30 00:40:59 -07:00
Michael Miller
5cccf5b4cb
Support example as block argument to let and subject
Surprisingly, RSpec supports this.
https://relishapp.com/rspec/rspec-core/v/3-10/docs/metadata/current-example
2021-01-22 23:00:17 -07:00
Michael Miller
76378c9dae
Whitespace 2021-01-21 21:05:12 -07:00
Michael Miller
a8840351d5
More work hooking up expectations 2021-01-21 00:03:57 -07:00
Michael Miller
b7ed4ec14c
Nest spec types 2021-01-21 00:03:39 -07:00
Michael Miller
ce6f77656a
Use ExpectationFailed instead of AssertionFailed 2021-01-20 21:38:34 -07:00
Michael Miller
98a29309ff
Remove assert methods 2021-01-20 21:36:18 -07:00
Michael Miller
f97e5365e3
Merge branch 'example-api' of gitlab.com:arctic-fox/spectator into example-api 2021-01-16 18:05:48 -07:00
Michael Miller
73dc7ae811
Fix copy/paste docs 2021-01-16 17:16:31 -07:00
Michael Miller
a7ac170153
Remove unused methods 2021-01-16 17:07:07 -07:00
Michael Miller
57c9333c1f
Match hook ordering of RSpec
Addresses https://github.com/icy-arctic-fox/spectator/issues/12
2021-01-16 17:04:42 -07:00
Michael Miller
cd519178ac
Remove whitespace 2021-01-16 16:52:41 -07:00
Michael Miller
13061cfb38
Workaround context scope not used in method delegation 2021-01-16 16:52:16 -07:00
Michael Miller
153933b044
Add DSL and code to create around_each hooks 2021-01-16 16:47:40 -07:00
Michael Miller
36c2a5d368
Logic for around_each hooks 2021-01-16 16:28:33 -07:00
Michael Miller
5ea83f51bb
Cache implicit subject 2021-01-16 12:10:52 -07:00
Michael Miller
d738494fdf
Cleanup example name output 2021-01-16 11:49:43 -07:00
Michael Miller
3527507639
Remove debug 2021-01-16 11:13:20 -07:00
Michael Miller
3ec267abbb
Fix reporting for should syntax 2021-01-16 11:12:41 -07:00
Michael Miller
97923d6bcd
Handle nil labels 2021-01-16 11:11:42 -07:00
Michael Miller
0992bad7eb
Get harness compiling again 2021-01-16 11:03:05 -07:00
Michael Miller
175ce8f293
Include matchers DSL 2021-01-16 11:02:49 -07:00
Michael Miller
4500ebcddc
Update old references to Value and Block 2021-01-16 11:02:29 -07:00
Michael Miller
58e7981b0c
Fix type warning 2021-01-16 11:00:54 -07:00
Michael Miller
e09f5c960a
Change Assertions to Expectations
Start expectation rework.
2021-01-16 10:22:23 -07:00
Michael Miller
50d1f69230
Don't cache the block return value
Let the matcher handle this if it needs to.
2021-01-15 23:15:07 -07:00
Michael Miller
a74957204b
Introduce abstract generic value type
Sits between AbstractExpression and Value and Block.
2021-01-15 22:32:02 -07:00
Michael Miller
4ed8c4a573
Implement remaining assertion macros
Move "should" methods.
2021-01-10 11:09:28 -07:00
Michael Miller
096c31d7f5
Initial work on assertions 2021-01-09 19:50:32 -07:00
Michael Miller
122395837f
Implement remaining value DSL macros 2021-01-09 17:36:50 -07:00
Michael Miller
391325d431
Initial work on values DSL 2021-01-09 17:01:33 -07:00
Michael Miller
4108a6602d
Simplify get method 2021-01-09 16:57:23 -07:00
Michael Miller
3e4b77da77
Create value wrapper 2021-01-09 16:51:37 -07:00
Michael Miller
aa4c257ade
Change Wrapper to a nested type for Lazy 2021-01-09 14:35:58 -07:00
Michael Miller
5cac4aa5a1
Add lazy utility 2021-01-09 14:19:40 -07:00
Michael Miller
fb0423ed02
Move top-level types into spectator/ sub-directory 2021-01-09 13:56:32 -07:00
Michael Miller
7451769a29
Pass current example as block argument 2021-01-09 13:34:15 -07:00
Michael Miller
009ca4776a
Cleanup new DSL macros 2021-01-09 13:17:42 -07:00
Michael Miller
fbd9713d52
Remove unused and deprecated types 2021-01-09 12:56:35 -07:00
Michael Miller
2e8036d230
Move instance variable 2021-01-09 12:48:53 -07:00
Michael Miller
65dba9f317
Don't need delegates stored in hooks
Use proc instead. The context can be retrieved from the example 
instance.
2021-01-09 12:04:27 -07:00
Michael Miller
c4289b82da
Better trace message for initial hook processing 2021-01-09 11:33:29 -07:00
Michael Miller
df096d91aa
Capture source info for hooks 2021-01-09 11:30:00 -07:00
Michael Miller
def66acc15
Trace hook invocation 2021-01-09 11:14:27 -07:00
Michael Miller
e5cbc8d631
Promote hooks to fully-fledge types
Hook types include a source, label, and context delegate.
2021-01-09 11:06:59 -07:00
Michael Miller
cf422eca02
Add null constructor 2021-01-09 10:56:33 -07:00
Michael Miller
7d0ba752e9
Change ExampleNode to SpecNode 2021-01-09 10:39:04 -07:00
Michael Miller
0ee708281f
Cleanup hook macros 2021-01-09 10:27:54 -07:00
Michael Miller
950f6b3424
Add block expression 2021-01-09 00:13:22 -07:00
Michael Miller
fbe9f22e02
Start rework on capturing expressions 2021-01-09 00:12:28 -07:00
Michael Miller
c2d5bdd5d1
Bump version to 0.9.31 2021-01-08 15:32:42 -07:00
Michael Miller
2ecd4ded6d
Fix line numbers being wrong with macro expansion
Addresses https://github.com/icy-arctic-fox/spectator/issues/18
2021-01-08 15:32:15 -07:00
Michael Miller
b697511761
Slight doc improvement 2020-12-31 18:45:56 -07:00
Michael Miller
4c6b6e6436
Merge branch 'master' into example-api 2020-12-23 14:52:53 -07:00
Michael Miller
891cd4bbf7
Change includes to has 2020-12-23 14:39:24 -07:00
Michael Miller
20caed9262
Add contain matcher improvements to have matcher 2020-12-23 14:38:30 -07:00
Michael Miller
edf8ae36df
Fix negated contain case 2020-12-23 14:19:40 -07:00
Michael Miller
a2ef0fa46a
Consistent comments 2020-12-23 14:17:05 -07:00
Michael Miller
de1af7178c
Fix string usage with contain matcher 2020-12-23 14:11:50 -07:00
Michael Miller
f6fc36f60a
Bump version to 0.9.30 2020-12-23 13:56:19 -07:00
Michael Miller
875ca587f3
Show missing values in error output 2020-12-23 13:44:12 -07:00
Michael Miller
f465df48d4
Fix copy/paste fail docs 2020-12-23 13:18:36 -07:00
Michael Miller
5ec7e25d57
Remove splat 2020-12-23 12:54:44 -07:00
Michael Miller
c720147974
Bump version to 0.9.29 2020-12-23 12:39:05 -07:00
Michael Miller
0540f94823
Add contain_elements and have_elements variants 2020-12-23 12:38:37 -07:00
Michael Miller
4533cffce7
Initial code to run hooks 2020-11-15 11:25:07 -07:00
Michael Miller
2f4cbd9c33
Specify contents of event trigger method with macro block
Implement calling parent group hooks.
2020-11-15 11:22:52 -07:00
Michael Miller
0279606a1c
Placeholder code for after hooks 2020-11-15 11:22:06 -07:00
Michael Miller
19d57dd828
Add call_once variant of events 2020-11-14 17:02:24 -07:00
Michael Miller
b4e74444d1
Some work on hooks in DSL 2020-11-08 22:21:52 -07:00
Michael Miller
7d54884196
Don't pass context, get/cast from example instance 2020-11-08 16:53:54 -07:00
Michael Miller
b8dc83286c
Upcast context to reduce method instances generated by compiler 2020-11-08 16:52:08 -07:00
Michael Miller
f433405ece
Scratch work
Trying to implement hooks. Ran into a problem with contexts.
2020-11-08 15:06:49 -07:00
Michael Miller
688c08b087
Initial work on hooks rework 2020-11-07 22:04:37 -07:00
Michael Miller
1f319a70ce
Add docs 2020-11-07 22:04:21 -07:00
Michael Miller
4230ec70a0
Move test handling code to Harness 2020-11-07 20:56:30 -07:00
Michael Miller
dba2e23750
Typo 2020-11-07 15:24:22 -07:00
Michael Miller
f7fe177685
Minor adjustments 2020-11-07 15:01:08 -07:00
Michael Miller
8ae6ef478b
Dynamic examples with null context 2020-11-07 14:43:59 -07:00
Michael Miller
40dd85eb38
Bit of naming cleanup 2020-11-07 13:47:39 -07:00
Michael Miller
347e1a84e5
Dedicated example runner type 2020-11-07 13:47:31 -07:00
Michael Miller
b8901d485d
Merge branch 'master' into example-api 2020-11-07 11:18:47 -07:00
Michael Miller
27754c9e03
Bump version to 0.9.28 2020-11-07 11:04:34 -07:00
Michael Miller
b91103b40a
Handle case where block is provided with return type 2020-11-07 11:04:03 -07:00
Michael Miller
8966c0976b
Allow manual specification of return type 2020-11-07 10:56:33 -07:00
Michael Miller
e8afe5070b
Address Ameba issues 2020-10-19 20:34:18 -06:00
Michael Miller
a0e6d5c4e8
Re-introduce config options 2020-10-19 20:19:25 -06:00
Michael Miller
c36e006c85
Move top-level DSL to its own module 2020-10-17 22:57:27 -06:00
Michael Miller
87c8914187
Typo 2020-10-17 22:12:47 -06:00
Michael Miller
e4f3d334ed
Consistent naming of random seed 2020-10-17 22:12:02 -06:00
Michael Miller
225e1a52ba
Clean up example randomization 2020-10-17 22:11:04 -06:00
Michael Miller
b2bf980685
Some config cleanup 2020-10-17 21:39:41 -06:00
Michael Miller
79499c5d2e
Add config to spec builder 2020-10-17 17:40:38 -06:00
Michael Miller
4462f27316
Rework result types 2020-10-17 14:56:31 -06:00
Michael Miller
788b12a8bc
Fix example methods overriding previously defined methods 2020-10-17 12:12:04 -06:00
Michael Miller
27875631d3
Mostly implement inspect method 2020-10-17 11:51:16 -06:00
Michael Miller
9c1fd6fb5a
Use standard log utility 2020-10-17 11:46:21 -06:00
Michael Miller
e6d78345c4
Rename debug macro 2020-10-17 11:25:46 -06:00
Michael Miller
4974054de7
Some code to run a spec 2020-10-17 11:23:51 -06:00
Michael Miller
2cdee0716f
Bump version to 0.9.27 2020-10-01 18:25:29 -06:00
Michael Miller
9ac6121201
New stub syntax to support operator methods
Works like:
  stub :[], index : Int32 { 42 }

Addresses https://github.com/icy-arctic-fox/spectator/issues/14
2020-10-01 18:23:28 -06:00
Michael Miller
f71a8ac6a3
Merge branch 'master' into example-api 2020-09-27 12:46:38 -06:00
Michael Miller
93fa6f6e72
Bump version to 0.9.26 2020-09-27 10:35:28 -06:00
Michael Miller
e68697a212
Fix stubbed yielding method calling original instead of stub 2020-09-27 10:30:51 -06:00
Michael Miller
0970f02465
Yield instead of forwarding block
Forwarding the block like this captures it, which prevents yield from 
being used.
Addresses https://gitlab.com/arctic-fox/spectator/-/issues/54
2020-09-27 10:14:30 -06:00
Michael Miller
ec6018bed4
Start reactivating runner 2020-09-27 09:10:27 -06:00
Michael Miller
579fcacfde
Move spec builder 2020-09-26 22:51:58 -06:00
Michael Miller
d663e82c36
Improve internal error handling output 2020-09-26 22:25:53 -06:00
Michael Miller
543df88d39
Forward build method 2020-09-26 22:25:04 -06:00
Michael Miller
4567162459
Prevent defining an example or group in a test 2020-09-26 19:23:57 -06:00
Michael Miller
99a9d7960a
Formatting 2020-09-26 19:23:16 -06:00
Michael Miller
60795a371d
Reorganize 2020-09-26 19:15:34 -06:00
Michael Miller
b8ba38152e
Cleanup example description handling 2020-09-26 19:14:08 -06:00
Michael Miller
1d359efcb0
Improve source line detection 2020-09-26 19:12:42 -06:00
Michael Miller
1ad41ac016
Cleanup group description handling 2020-09-26 19:11:52 -06:00
Michael Miller
cccfa8ea1d
Formalize Spectator debug 2020-09-26 18:23:48 -06:00
Michael Miller
f1ad476ae5
Trick to use one version string from shard.yml 2020-09-26 18:16:21 -06:00
Michael Miller
f4a05502f9
Example names can't be a symbol 2020-09-26 18:14:59 -06:00
Michael Miller
96a7989815
Remove unreferenced code 2020-09-26 18:14:41 -06:00
Michael Miller
acb3b16496
Add some docs 2020-09-26 18:14:22 -06:00
Michael Miller
de99fce5b1
Merge branch 'master' into example-api 2020-09-26 11:10:55 -06:00
Michael Miller
a39223ff21
Bump to 0.9.25 2020-09-26 11:03:11 -06:00
Michael Miller
a4680f2584
Don't splat values for failed match data
This caused an issue where keys with the same name as existing arguments 
couldn't be used.
In this case, "description" and "failure_message".

Fixes https://github.com/icy-arctic-fox/spectator/issues/13
2020-09-26 10:50:18 -06:00
Michael Miller
6363436afa
Nested macros for defining DSL keywords 2020-09-25 21:44:17 -06:00
Michael Miller
db284066f6
Bump version to 0.9.24 2020-09-17 10:13:41 -06:00
Michael Miller
a0af1e7cd1
Allow string interpolation in some macros
Enables interpolation in example and group descriptions, as well as 
anonymous doubles.
Addresses https://github.com/icy-arctic-fox/spectator/issues/10
2020-09-17 09:35:49 -06:00
Michael Miller
9103bfde0f
Playing around with line numbers
Trying to find some pattern in the line descripancies reported to the 
macros compared to the source file.
2020-09-14 20:00:17 -06:00
Michael Miller
bc602d9b62
Working example creation from DSL 2020-09-14 13:55:07 -06:00
Michael Miller
7c44cba667
Fix group creation via DSL 2020-09-12 18:40:56 -06:00
Michael Miller
dad669686c
Temporarily disable running examples 2020-09-12 18:40:36 -06:00
Michael Miller
6752c7c254
Move DSL-based code to subclass of SpectatorContext
This resolves a circular dependency.
2020-09-12 18:39:21 -06:00
Michael Miller
67ac06e4d6
Some initial spec builder code 2020-09-12 18:37:14 -06:00
Michael Miller
0190cc7260
Fix leading whitespace with root group 2020-09-12 18:35:31 -06:00
Michael Miller
98f886d9d4
Implement finished? method 2020-09-12 16:02:11 -06:00
Michael Miller
3133717323
Change NestedExampleGroup to ExampleGroup 2020-09-12 16:01:52 -06:00
Michael Miller
225c358cb8
Some initial work on cleaned up groups 2020-09-12 16:01:29 -06:00
Michael Miller
1d32946760
Note about docs in macros 2020-09-12 15:59:45 -06:00
Michael Miller
b271028c1e
Remove most includes for now 2020-09-12 15:59:20 -06:00
Michael Miller
e455708467
Add missing require statements 2020-09-12 15:58:54 -06:00
Michael Miller
6e3ec79a14
Remove SpecBuilder types 2020-09-12 15:58:07 -06:00
Michael Miller
8b205278ad
Change SpectatorTest to SpectatorContext 2020-09-12 15:57:20 -06:00
Michael Miller
50bae36ab0
Merge remote-tracking branch 'origin/master' into example-api 2020-09-12 15:44:56 -06:00
Michael Miller
ea6c154224
Change version to 0.10.0
Prepare for next minor release.
2020-09-12 15:43:28 -06:00
Michael Miller
a08c87dd5d
Remove workaround
https://github.com/icy-arctic-fox/spectator/issues/1 should be resolved 
by https://github.com/crystal-lang/crystal/pull/8234
2020-09-12 15:28:55 -06:00
Michael Miller
cce17ad55f
Fix filename 2020-09-12 14:34:24 -06:00
Michael Miller
b866bc7e08
Create example context variants 2020-09-06 10:31:23 -06:00
Michael Miller
3f7e0d7882
Add missing require statement 2020-09-05 19:55:46 -06:00
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
fbf574b0b9
Create ExampleGroup and use shared ExampleNode type 2020-09-05 16:47:40 -06:00
Michael Miller
0f9c1ad09c
Add require for json 2020-09-05 16:36:12 -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
9c6502234b
Define test context types 2020-09-05 14:55:49 -06:00
Michael Miller
4a7e0c8bd7
Bump version to 0.9.23 2020-08-30 12:44:37 -06:00
Michael Miller
a23b2d0753
Workaround for https://gitlab.com/arctic-fox/spectator/-/issues/53 2020-08-30 12:44:07 -06:00
Michael Miller
53c9dd0445
Display first line only after "Error:" 2020-08-16 10:00:04 -06:00
Michael Miller
ce248de0d9
Bump version to 0.9.22 2020-08-11 14:37:37 -06:00
Michael Miller
8f0718db86
Handle splat in macro for matcher DSL
Should fix https://github.com/icy-arctic-fox/spectator/issues/8
2020-08-11 14:37:37 -06:00
Michael Miller
9c14c69bba
Change "ditto" to ":ditto:" 2020-08-06 19:20:18 -06:00
Michael Miller
ac9a0cec4f
Bump version to 0.9.21
Reference latest Crystal.
2020-07-27 13:42:55 -06:00
Michael Miller
4e50108fb9
Use smaller range for default random seed
RSpec seems to use a smaller range, something like 65k (UInt16).
2020-07-27 13:39:57 -06:00
Michael Miller
e5ed6418db
Only include seed if report if randomized 2020-07-27 13:37:41 -06:00
Michael Miller
e168b0ac7a
Blank line before seed output 2020-07-27 13:32:49 -06:00
Michael Miller
8fc2c93960
Track seed used when just -r is provided 2020-07-27 13:32:39 -06:00
Michael Miller
ba29c1e032
Show random seed
Only works when a seed specified, not when a random seed is used.
2020-07-27 12:10:39 -06:00
Michael Miller
7aa8cb14a4
Force seed to UInt64 2020-07-27 10:37:08 -06:00
Michael Miller
a8e2e5c021
Store random seed 2020-07-27 10:36:53 -06:00
Michael Miller
f7d7e2440e Bump version to 0.9.20 2020-05-29 20:07:04 -06:00
Michael Miller
7fc25b84c3 Fix bug when using multiple short-hand block expects in one test
For instance, this would fail:
```
it "does something" do
  expect(&.foo).to be_true
  expect(&.false).to be_false
end
```
2020-05-29 20:06:37 -06:00
Michael Miller
5d8110ec6c Bump version to 0.9.19 2020-05-28 22:24:33 -06:00
Michael Miller
476e54bb2b Store expected value as array
Fixes issue where contain_exactly matcher would try to append to a tuple 
(which isn't allowed).
2020-05-28 22:23:29 -06:00
Michael Miller
c99401f7d5 Use ± symbol for range 2020-05-09 16:10:16 -06:00
Michael Miller
e2c2ebafd3 No need to specify arguments to super and previous_def 2020-04-28 08:30:40 -06:00
Michael Miller
131b01d42c Update version to 0.9.18 2020-04-26 11:47:55 -06:00
Michael Miller
d02b848ad5 Use the exact text from the describe value
This fixes described_class.new when using a generic type.
2020-04-26 11:13:07 -06:00
Michael Miller
3be9ffb7a0 Bump version to 0.9.17 2020-04-23 22:43:48 -06:00
Michael Miller
84476b0357 Treat to(mock) and to_eventually(mock) as the same
Fixes https://gitlab.com/arctic-fox/spectator/-/issues/48
2020-04-23 22:43:37 -06:00
Michael Miller
f329e2cbd5 Bump version to 0.9.16 (Crystal 0.34) 2020-04-06 18:24:28 -06:00
Michael Miller
6b0526fc45 Silence warnings from Crystal 0.34 2020-04-06 18:23:53 -06:00
Michael Miller
e891365ed7 Bump version to 0.9.15 2020-04-03 11:47:44 -06:00
Michael Miller
09e9c23115 Additional checks that the actual value satifies needed method 2020-04-03 11:47:11 -06:00
Michael Miller
7fadd92f62 Check that actual value is a collection
Previously, a compilation error would occur if the actual value didn't 
respond to `to_a`.
A way to reproduce this is for the actual value to be nilable.
2020-04-03 11:32:37 -06:00
Michael Miller
748c25afcb Fix issues with unordered array matcher 2020-04-03 11:01:54 -06:00
Michael Miller
7d463c6daa Bump version to 0.9.14 2020-04-01 22:18:02 -06:00
Michael Miller
a655abb7ac Fix issue when using nil with be matcher 2020-04-01 22:17:19 -06:00
Michael Miller
4595fca17a Bump to 0.9.13 2020-03-28 11:42:45 -06:00
Michael Miller
68bac59cab Hacky solution for https://gitlab.com/arctic-fox/spectator/-/issues/44
Don't use a proc stub, which doesn't support arguments.
2020-03-28 11:41:49 -06:00
Chris Watson
e53b1167b3 Make sure superclass isn't nil 2020-03-20 16:34:37 +00:00
Michael Miller
e343a97f37 Don't use a splat here 2020-03-07 17:05:52 -07:00
Michael Miller
cb9f5338fe Bump version to 0.9.11 2020-03-04 23:16:58 -07:00
Michael Miller
e126cb744b Ensure that a TypeNode is resolved
When describing a constant, the `resolve?` method can return a
non-TypeNode, which is the constant's value.
The Crystal docs seem to indicate this should only return `TypeNode` or
`NilLiteral`.
But, I can see when this would be useful to resolve a constant in a
macro.
To work around this, `described_class` and `subject` should only be
defined when it resolves to a `TypeNode`.

Fixes arctic-fox/spectator#40
Fixes arctic-fox/spectator#41
2020-03-04 23:16:29 -07:00
Michael Miller
d945a414f9 Bump version to 0.9.10 2020-03-03 16:23:53 -07:00
Michael Miller
d0f229c659 Pass example proc to around_each hook if there are no arguments 2020-03-03 15:20:25 -07:00
Michael Miller
5543c07766 Bump version to 0.9.9 2020-02-22 22:59:42 -07:00
Michael Miller
e92aa7ed57 Implicit subject should not use .new with modules
Fixes GitHub issue https://github.com/icy-arctic-fox/spectator/issues/6
2020-02-22 22:59:09 -07:00
Michael Miller
f5f1361477 Bump version to 0.9.8
Fixed GitHub Issue https://github.com/icy-arctic-fox/spectator/issues/5 - Thanks @jinn999
2020-02-21 09:57:09 -07:00
Davide Paolo Tua
2bf6682816 Fix accidental deletion 2020-02-21 13:23:33 +01:00
Davide Paolo Tua
83ac420273 Add test for fix, fix test for range_matcher 2020-02-21 13:19:27 +01:00
Davide Paolo Tua
ce9bf918c1 Fix syntax errors in be_between matcher 2020-02-21 12:48:22 +01:00
Michael Miller
3aaab0e74f Fix memoized subject from context description another way
The other method gave a strange compiler error when running specs.
Something to do with "K" not having an inspect method.

In /usr/share/crystal/src/hash.cr:1826:13

 1826 | key.inspect(io)
            ^------
Error: undefined method 'inspect' for K
2020-02-16 19:50:20 -07:00
Michael Miller
5cb74ebe95 Bump version to 0.9.7 2020-02-16 19:36:09 -07:00
Michael Miller
dd48bf6f25 Fix subject not being memoized when using described_class 2020-02-16 19:34:48 -07:00
Michael Miller
2aba67edae Fix idiosyncrasies around class method stubs
The new method misbehaves here.
It always appeared as defined, even though it isn't explicitly defined 
in the class.
2020-02-14 18:14:32 -07:00
Michael Miller
7a8e570bea Fix typo with should_eventually 2020-02-10 17:50:35 -07:00
Michael Miller
63ff59688b Bump version to 0.9.6 2020-02-10 17:47:02 -07:00
Michael Miller
a7db9ff0bb Don't force previous_def on class methods 2020-02-10 17:46:36 -07:00
Michael Miller
d30e65ee2d Missing ? on method name check 2020-01-20 20:42:16 -07:00
Michael Miller
721425c3c8 Run deferred expectations after all hooks 2020-01-20 20:15:49 -07:00
Michael Miller
60f1c3091b Allow be matcher to be used on structs 2020-01-19 22:39:21 -07:00
Michael Miller
b1984b343a Add should keywords to examples
Allows short-hand like:
it { should be_empty }
2020-01-19 22:12:06 -07:00
Michael Miller
e60c287216 Fix a dumb with merge 2020-01-19 10:05:21 -07:00
Michael Miller
1825026af7 Bump version to 0.9.4 2020-01-19 09:53:20 -07:00
Michael Miller
64f6456935 Merge branch 'specs' 2020-01-19 09:52:41 -07:00
Michael Miller
272ebcd693 Fix subject with group describing a type
An explicit subject should be used when describing a type. This mimics 
RSpec.
2020-01-19 09:52:12 -07:00
Michael Miller
a2508d5f6b Fix negation case for respond_to matcher 2020-01-17 22:08:52 -07:00
Michael Miller
e8a437dc0a Bump version to 0.9.3 2020-01-17 14:53:04 +03:00
Michael Miller
f825a34771 Fix issue with implicit vs. explicit subject
Addresses the issue pointed out in !25

There was a recent change that set a subject to the first argument of 
`describe` and `context`. This prevented an explicitly defined subject 
from being accessible in nested groups.
2020-01-17 14:53:03 +03:00
Michael Miller
2b2fb5af3a Bump version to 0.9.3 2020-01-16 18:37:04 -07:00
Michael Miller
13a0b9e2d3 Fix issue with implicit vs. explicit subject
Addresses the issue pointed out in !25

There was a recent change that set a subject to the first argument of 
`describe` and `context`. This prevented an explicitly defined subject 
from being accessible in nested groups.
2020-01-16 18:36:40 -07:00
Michael Miller
b25388a165 Merge branch 'specs' of gitlab.com:arctic-fox/spectator into specs 2020-01-14 20:10:53 -07:00
Michael Miller
d807f9866a Bump version to 0.9.2 2020-01-14 20:09:15 -07:00
Michael Miller
c48b9ed9e1 Resolve let! not working on uninferable types
Resolves https://github.com/icy-arctic-fox/spectator/issues/4
Use ValueWrapper trick again and initialize immediately with before_each 
hook.
2020-01-14 20:07:56 -07:00
Michael Miller
d5c5a82395 Add with_message modifier to raise_error matcher 2020-01-06 23:46:38 -07:00
Michael Miller
f11b548f4e Mimic RSpec behavior of match matcher
The code:
expect(/foo/).to match("food")
would normally evaluate:
"food" === /foo/
which is false.
However, in RSpec, this expectation is true.
2020-01-06 23:01:45 -07:00
Michael Miller
5fa6b5d549 Fix negation expectation text 2020-01-06 22:11:36 -07:00
Michael Miller
590d81979e Workaround typing issues 2020-01-06 22:04:05 -07:00
Michael Miller
5673144527 Fix negative match case for contain/cover matcher 2020-01-05 23:01:25 -07:00
Michael Miller
b7c686e836 Add cover matcher
Works the same as `contain` but is for ranges.
2020-01-05 22:49:27 -07:00
Michael Miller
8143229fdb Fix failure message 2020-01-05 22:47:57 -07:00
Michael Miller
034c1cd6cb Change array matcher to allow any order 2020-01-05 11:42:39 -07:00
Michael Miller
93c442d1e2 Add instance_of matcher to check exact type 2020-01-04 12:46:08 -07:00
Michael Miller
8cfed440ed Fix typo with be_a matcher 2020-01-04 12:45:49 -07:00
Michael Miller
c3688807d4 Add kind_of aliases for be_a matcher 2020-01-04 10:08:01 -07:00
Michael Miller
34060ce181 Ensure top-level Crystal types are used 2020-01-04 09:49:28 -07:00
Michael Miller
c4a97230f1 Remove unecessary members provided by ValueMatcher 2020-01-04 09:33:14 -07:00
Michael Miller
4c9d767137 Add missing description arguments 2020-01-04 09:32:56 -07:00
Michael Miller
71740113d5 Allow subject for non-class types 2020-01-02 19:30:46 -07: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
d64ecc4192 Store matcher description in MatchData 2020-01-02 19:16:33 -07:00
Michael Miller
00fe913d77 Add predicate method to check for description 2020-01-02 18:43:30 -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
061028782b Workaround for what seems to be a Crystal macro bug
The syntax:
stub instance.==(other) { true }
effectively becomes:
stub instance.==(other { true })
2020-01-01 21:48:58 -07:00
Michael Miller
612222ace8 Update version to 0.9.1 2019-12-13 20:26:22 -07:00
Michael Miller
8ccc08b472 Fix reflection (verify double) on self arg type
There is still an issue with using _ for a placeholder.
2019-12-13 20:25:18 -07:00
Michael Miller
16625cf495 Registry#expect takes a stub 2019-12-13 19:56:43 -07:00