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
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
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
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
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
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
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
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
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
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
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
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
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
53c9dd0445
Display first line only after "Error:"
2020-08-16 10:00:04 -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
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
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
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
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
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
6b0526fc45
Silence warnings from Crystal 0.34
2020-04-06 18:23:53 -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
a655abb7ac
Fix issue when using nil with be
matcher
2020-04-01 22:17:19 -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
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
d0f229c659
Pass example proc to around_each hook if there are no arguments
2020-03-03 15:20:25 -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
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
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
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
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
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
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
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
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
Michael Miller
a38625f8a7
Remove GenericMethodCall
...
This type isn't needed. MethodCall is suitable after moving arguments to
it.
2019-12-13 19:54:06 -07:00
Michael Miller
a6aa00eb38
Fix double default stub with type
2019-12-13 19:17:08 -07:00
Michael Miller
4c9bbbe07b
Formatting
2019-12-08 15:11:23 -07:00
Michael Miller
0ae5cdc9ae
Remove debug
2019-12-08 15:11:08 -07:00
Michael Miller
1a30a56f2a
Better stringified call
2019-12-08 15:10:49 -07:00
Michael Miller
91696d490f
Check if underlying type responds to method
2019-12-08 15:08:13 -07:00
Michael Miller
067c789019
Initial work on type reflection for verifying doubles
2019-12-08 14:52:54 -07:00
Michael Miller
074aff531c
Add "anything" which always returns true when compared against
2019-12-08 14:52:28 -07:00
Michael Miller
07ce835724
VerifyingDouble should be abstract
2019-12-08 14:51:48 -07:00
Michael Miller
8b0f509689
Detect when to use a verifying double
2019-12-08 11:37:08 -07:00
Michael Miller
8197a82ace
Expect stubs not method names
...
Needed for argument syntax:
`expect(dbl).to receive(:foo).with(:bar)`
2019-11-29 09:25:58 -07:00
Michael Miller
c710961be1
Fix returned type inferred to NoReturn
2019-11-29 08:53:36 -07:00
Michael Miller
d6c1169bc3
Fix dumb syntax
2019-11-20 20:40:53 -07:00
Michael Miller
5d84536e1e
Implement and_call_original
2019-11-20 19:17:51 -07:00
Michael Miller
f8563e86c7
Pass along original block
2019-11-20 16:29:06 -07:00
Michael Miller
2dee50f19e
Pass original (and type constraint) to stub via block
2019-11-20 15:43:45 -07:00
Michael Miller
51a47fec98
Remove unused RT parameter
2019-11-20 15:05:04 -07:00
Michael Miller
27acf7bced
Allow receive block syntax
2019-11-19 17:28:00 -07:00
Michael Miller
b062472d98
Revert "Initial support for and_yield"
...
This reverts commit e49bd0d57a
.
Removing support for stubbed yield.
Attempting to yield with different a different arity or argument types causes compilation errors.
I don't see any easy fix for this.
I would rather have no yield support than broken support.
2019-11-17 13:30:09 -07:00
Michael Miller
e49bd0d57a
Initial support for and_yield
2019-11-17 13:12:39 -07:00
Michael Miller
b896a7f1d5
Implement stub that raises
2019-11-17 12:53:18 -07:00
Michael Miller
6e287f864b
Implement returning multiple values
2019-11-17 12:26:02 -07:00
Michael Miller
1a3f663b70
Name is optional for doubles
2019-11-17 10:47:51 -07:00
Michael Miller
a63d3d05a5
Negation for receive matchers
2019-11-17 10:32:37 -07:00
Michael Miller
5da231a5e8
Check expectations for anonymous double
2019-11-17 10:14:03 -07:00
Michael Miller
45fe6217b4
Missing args
2019-11-17 09:42:19 -07:00
Michael Miller
ac9b3ad1fe
Implement expect_any_instance_of
2019-11-16 21:27:18 -07:00
Michael Miller
a15e2a97b1
Allow deferred expectation of multiple stubs
2019-11-16 15:24:23 -07:00
Michael Miller
a8e0f46645
Revert "Coerce operations in match? to booleans"
...
This reverts commit 76c21d447a
.
Should no longer be needed since mocks and doubles should indirectly leak into StandardMatcher types.
2019-11-16 15:15:53 -07:00
Michael Miller
d9d30c57d0
Merge ReceiveArgumentsMatcher and ReceiveMatcher
...
Finally found the issue causing other matchers derived from
StandardMatcher to be "leaked" doubles and mocks indirectly.
The if-condition in ExpectationPartial#to and #to_not caused the matcher
to be given the StandardMatcher type instead of a union type.
This lead to really strange compilation errors and wasted a lot of
hours.
2019-11-16 15:14:38 -07:00
Michael Miller
f0bfd8b6d4
Switch to run-time error for unsupported negation
2019-11-16 13:18:09 -07:00
Michael Miller
201fe614d1
Expect messages on double, but don't stub them
2019-11-16 10:59:13 -07:00
Michael Miller
186fa15a1a
Add method to check for stub
2019-11-16 10:06:11 -07:00
Michael Miller
8dbfb2d6ec
Revert "Allow expected value to receive stub"
...
This reverts commit 6cd410c4c7
.
Should not stub the method.
The end-user needs to do this.
2019-11-16 09:23:45 -07:00
Michael Miller
c9fb4d2d33
Don't run deferred blocks if the test fails
...
This also prevents overriding the test's original error with on that may
occur in the deferred blocks.
2019-11-16 09:06:47 -07:00
Michael Miller
23d8f4b5a6
Formatting
2019-11-16 09:03:24 -07:00
Michael Miller
ca85acefaf
Resolve issue trying to splat union of named tuples
2019-11-16 09:02:57 -07:00
Michael Miller
85531fecf9
Fix truthy values not being strings
2019-11-16 09:01:03 -07:00
Michael Miller
76c21d447a
Coerce operations in match? to booleans
...
The compiler is merging null-doubles with these matchers.
Methods that normally return a boolean instead return the instance
(self).
This causes a return type-mismatch.
There should be a better alternative to this.
2019-11-16 08:49:09 -07:00
Michael Miller
6cd410c4c7
Allow expected value to receive stub
2019-11-16 08:32:13 -07:00
Michael Miller
72e4ac8fe9
Remove unnecessary free variables
2019-11-16 08:17:46 -07:00
Michael Miller
3c94d1f8fd
Workaround for generic argument type issue
2019-11-15 21:18:51 -07:00
Michael Miller
2dc86c05ac
Initial work on deferred have_received check
2019-11-14 19:35:13 -07:00
Michael Miller
98bfed2f83
Expose name and source
2019-11-14 19:17:55 -07:00
Michael Miller
ac3a5c8515
Store GenericArguments
2019-11-14 19:15:51 -07:00
Michael Miller
763c99f338
Formatting
2019-11-14 18:48:43 -07:00
Michael Miller
28ec1062e8
Merge branch 'release/0.9' into dev/mocks-and-doubles
2019-11-14 18:47:25 -07:00
Michael Miller
6b3885af30
Run deferred blocks
2019-11-14 18:41:26 -07:00
Michael Miller
2128184659
Implement defer logic in harness
2019-11-14 18:30:48 -07:00
Michael Miller
173f7bfa13
Add should_eventually and should_never methods
2019-11-14 18:26:24 -07:00
Michael Miller
a80d018ff6
Remove type annotation/requirement
2019-11-14 18:23:45 -07:00
Michael Miller
bd0396c001
Add to_eventually and to_never operations
...
This defines what they should look like.
2019-11-14 18:19:37 -07:00
Michael Miller
b40abe8057
Fix GenericArguments#to_s
2019-11-14 18:06:20 -07:00
Michael Miller
acad88204a
Fix issues with creating anonymous null doubles
2019-11-14 17:55:56 -07:00
Michael Miller
e44f0229d6
Allow stubbing/overriding anonymous double methods
2019-11-14 17:12:27 -07:00
Michael Miller
b9fe1b6a60
Initial code to support anonymous doubles
2019-11-12 21:55:16 -07:00
Michael Miller
b0562981f7
Change double name to string
2019-11-12 21:54:55 -07:00
Michael Miller
38ec44c9ac
Simplify type resolution code
2019-11-12 21:46:33 -07:00
Michael Miller
cb466b4ff5
Display better error when a double isn't found/defined
2019-11-12 21:44:35 -07:00
Michael Miller
87a60cf92a
Split out double macros
2019-11-12 21:21:30 -07:00
Michael Miller
f50e71606e
Make derived double names safer
2019-11-12 21:13:44 -07:00
Michael Miller
94e210c306
Implement null doubles
2019-11-11 23:40:08 -07:00
Michael Miller
48ea53c2f5
Formatting
2019-11-11 23:30:36 -07:00
Michael Miller
c3cba6962c
Get stubs on class methods (self.) working
2019-11-11 23:30:30 -07:00
Michael Miller
233e9573de
Placeholders for delayed message expectation
2019-11-11 22:36:29 -07:00
Michael Miller
20f68e956d
Add receive_messages macro to stub multiple methods
2019-11-11 22:27:53 -07:00
Michael Miller
9c161a07ff
Support for canned responses in double creation
2019-11-11 22:17:37 -07:00
Michael Miller
73e3f8fd66
Raise on non-defined methods
2019-11-11 22:11:58 -07:00
Michael Miller
925af7908b
Raise UnexpectedMessageError
2019-11-11 22:08:36 -07:00
Michael Miller
18b3879dce
Treat symbols and non-symbols the same
2019-11-11 20:59:33 -07:00
Michael Miller
fd2c6d3d8c
Remove reference to test
...
Disallows group context values being used within double definitions.
This had an adverse effect where context values could be called on the
double (dbl.foo).
2019-11-11 20:59:12 -07:00
Michael Miller
96aae8f6d5
Use harness variable
2019-11-10 13:49:10 -07:00
Michael Miller
6c0693f2a4
Add default stubs from parent contexts
2019-11-10 13:22:18 -07:00
Michael Miller
d2e27d1e6e
Pass test context to registry
2019-11-10 13:08:43 -07:00
Michael Miller
2bc4f71edb
Add stubs in reverse order
2019-11-10 13:04:28 -07:00
Michael Miller
4fea5ea435
Add ability to define default stub for mocks
2019-11-10 12:49:36 -07:00
Michael Miller
eb1a99b3ab
Fix deque creation
2019-11-10 12:49:24 -07:00
Michael Miller
14876a8e9a
Add default stubs to TestContext
...
Pass default stubs into mocks registry on example startup.
2019-11-10 12:35:03 -07:00
Michael Miller
a2b72eaa36
Implement allow_any_instance_of
2019-11-10 09:46:23 -07:00
Michael Miller
f816a64770
Resolve issue with harness trying to be used outside of test
2019-11-10 07:27:59 -07:00
Michael Miller
11ea7bf2ce
Move mock containment to harness
2019-11-09 23:22:21 -07:00
Michael Miller
e4aae1f60a
Change Registry to a class
2019-11-09 23:05:22 -07:00
Michael Miller
e0d12e9d0d
Use class name instead of hash of type
...
Hash of type could collide, though unlikely.
2019-11-09 22:32:49 -07:00
Michael Miller
0471794814
Store stubs in reverse order
2019-11-09 22:13:02 -07:00
Michael Miller
17695d35cf
Fix cast to nil when nil is expected
...
Resolves `TypeCastError: The return type of stub #... : Nil at ...:##
doesn't match the expected type Nil`
2019-11-09 21:30:59 -07:00
Michael Miller
e9f7e65ac9
Add mock registry prep
2019-11-09 10:49:29 -07:00
Michael Miller
74eb4fc11a
Reset stubs after each test
2019-11-09 10:39:02 -07:00
Michael Miller
c03808dfce
Handle super vs previous_def
2019-11-09 09:45:57 -07:00
Michael Miller
66dc6bf098
Uncomment predicate matcher
2019-11-09 09:38:11 -07:00
Michael Miller
48363951c2
Update receive matchers to use registry
2019-11-09 09:23:01 -07:00
Michael Miller
9e8286f892
Move double info to registry
2019-11-09 09:18:34 -07:00
Michael Miller
5a072301af
Don't require registration
2019-11-09 09:15:41 -07:00
Michael Miller
fc0b46caca
Use Registry for storing stubs
2019-11-09 09:08:09 -07:00
Michael Miller
aa33acd14e
Anything can be passed to allow()
2019-11-09 09:07:54 -07:00
Michael Miller
8262bb0316
Rename OpenMock to Allow
2019-11-09 09:05:17 -07:00
Michael Miller
0698ed655d
Switch to using Registry for mocks and fix various issues
2019-11-09 09:03:36 -07:00
Michael Miller
8c2f8d973b
Don't embed mock info in type
...
This can cause problems. Need to use a registry approach.
2019-11-09 09:03:07 -07:00
Michael Miller
875333cffe
Initial mock registry code
2019-11-06 21:02:24 -07:00
Michael Miller
cf8e028bd9
Some updates to mocks
...
Not working correctly for some cases, specifically String.
The default stub can seriously mess up Crystal internals.
It looks like the stubs and spy information will need to be kept outside
the instance.
2019-11-03 15:07:25 -07:00
Michael Miller
db09274746
Forgot to check-in argument matcher
2019-11-03 14:50:51 -07:00
Michael Miller
e3b9cef221
Remove type restriction
...
Not sure if this will blow up the type resolution, but seems to fix
argument comparison from recorded calls.
2019-11-03 14:49:10 -07:00
Michael Miller
82e01e44de
Copy-paste and tweak to implement argument expectations
2019-11-03 14:48:08 -07:00
Michael Miller
4acf6aaa58
Add range to description and failure message
2019-11-03 14:28:57 -07:00
Michael Miller
46aff9e11c
Add utility methods for setting count
2019-11-03 14:00:40 -07:00
Michael Miller
dabd3a7658
Use ranges to specify call count
2019-11-03 13:59:38 -07:00
Michael Miller
2048267eef
Allow specifying receive count
...
Updated checks and failure output to support this.
2019-11-03 13:22:00 -07:00
Michael Miller
b107511c9e
Include stub source in to_s
2019-11-03 13:13:54 -07:00
Michael Miller
59884f253f
Better handling of casting with covariance and contravariance
2019-11-03 13:04:44 -07:00
Michael Miller
2a484d5816
Fix return type
2019-11-03 12:07:21 -07:00
Michael Miller
f1a7018718
Remove unnecessary initializer
2019-11-03 12:05:26 -07:00
Michael Miller
9294599440
Basic to_s for stubs
2019-11-03 11:59:12 -07:00
Michael Miller
d1b54ad48f
Better error for when stubs don't match return type
2019-11-03 11:56:04 -07:00
Michael Miller
e6c1a6b2d2
Fix arg passing and implement arg matching
2019-11-03 11:42:31 -07:00
Michael Miller
1756670710
Add to_s method
2019-11-03 11:42:07 -07:00
Michael Miller
477271d297
Use NilMethodStub by default
...
Provides one place that #with can be defined and enforces ordering.
2019-11-03 11:23:04 -07:00
Michael Miller
af9104dfe4
Store arguments in method stub
...
Needed for matching arguments (setting constraints).
2019-11-03 11:18:46 -07:00
Michael Miller
20b80cc85a
Formatting
2019-11-03 10:07:32 -07:00
Michael Miller
cab9366fe8
Merge branch 'dev/mocks-and-doubles' of gitlab.com:arctic-fox/spectator into dev/mocks-and-doubles
2019-11-03 10:07:11 -07:00
Michael Miller
3931f420fe
Formatting
2019-11-03 10:03:09 -07:00
Michael Miller
5b143cb72c
Change structure around
2019-11-03 10:02:53 -07:00
Michael Miller
c95e228bde
Move mocks to their own module
2019-11-03 09:44:32 -07:00
Michael Miller
0c7de3d0d1
Merge branch 'dev/mocks-and-doubles' of gitlab.com:arctic-fox/spectator into dev/mocks-and-doubles
2019-11-02 19:58:56 -06:00
Michael Miller
42aaae7908
Some initial work on mocks
2019-11-02 19:58:47 -06:00
Michael Miller
541dc661ca
Only accept exact parameters, don't use splats
2019-11-02 09:45:34 -06:00
Michael Miller
e035afa85f
Rework let and subject to allow super
...
This addresses https://gitlab.com/arctic-fox/spectator/issues/32
2019-10-24 20:47:48 -06:00
Michael Miller
3dd691a990
Record call to stub
2019-10-13 18:50:19 -06:00
Michael Miller
76fa7e294f
Friendlier descriptions of objects
2019-10-13 18:49:22 -06:00
Michael Miller
d422376aaf
Initial work on have_received matcher
2019-10-13 18:41:10 -06:00
Michael Miller
8cbe2edf30
Formatting
2019-10-13 17:36:55 -06:00
Michael Miller
b09898d131
Rename @stubs to @spectator_stubs
2019-10-13 11:36:31 -06:00
Michael Miller
aecdb514b3
Implement basic and_return
2019-10-12 22:35:07 -06:00
Michael Miller
27bc976ae3
Try handling different method signatures and blocks
2019-10-12 21:30:20 -06:00
Michael Miller
211050650e
Remove internal double class
...
Stub handling method should be called from nested methods.
2019-10-12 21:08:49 -06:00
Michael Miller
c80a28d616
More work on method stubs
2019-10-12 20:53:17 -06:00
Michael Miller
0b6465e6bc
Started playing around with method stubs
2019-10-12 16:30:46 -06:00
Michael Miller
4b57ddab80
Handle changing test scope
...
This matches the current pattern, where a nested scope can override
values from a parent scope.
I think this solution is quite clever :)
2019-10-06 11:12:06 -06:00
Michael Miller
1bbe5067b6
Handle deferred stub with type
2019-10-06 10:24:51 -06:00
Michael Miller
49764e5873
Use do...end for multi-line stub def
2019-10-05 22:43:40 -06:00
Michael Miller
6b85bb7ed7
Default raise if stub is called without defintion
2019-10-05 22:42:33 -06:00
Michael Miller
0528ddc2ab
Handle stubbed methods with arguments
2019-10-05 22:22:31 -06:00
Michael Miller
47ca96801b
Mark internal class as private
...
Minimal doubles should be done.
2019-10-05 22:06:03 -06:00
Michael Miller
00c0553426
Get contextual values working with doubles
2019-10-05 07:38:13 -06:00
Michael Miller
d08ec75db7
Minimal working double
2019-10-04 23:16:40 -06:00
Michael Miller
bff2668ad4
Remove old files
2019-10-04 23:16:22 -06:00
Michael Miller
c458a490bf
Remove usage of sample values
2019-10-04 23:01:46 -06:00
Michael Miller
8c180e818f
Merge remote-tracking branch 'origin/release/0.9' into mocks-and-doubles
2019-09-27 14:12:29 -06:00
Michael Miller
425240e66f
Merge branch 'release/0.9' into mocks-and-doubles
2019-09-27 14:07:02 -06:00
Michael Miller
0e3727b504
Run after-all hooks correctly
2019-09-26 22:53:16 -06:00
Michael Miller
60ca4361de
Fix implicit subject
2019-09-26 21:44:25 -06:00
Michael Miller
f47c48b483
Add pre- and post-conditions
2019-09-26 21:37:29 -06:00
Michael Miller
1eec9190dd
Workaround for subject evaluation
2019-09-26 21:24:50 -06:00
Michael Miller
07aeaecca4
Add support for pending tests
2019-09-26 20:46:28 -06:00
Michael Miller
25778d7b41
Change "what" to "description"
2019-09-26 16:49:44 -06:00
Michael Miller
edabaa9447
Dumb auto-format
2019-09-26 16:25:43 -06:00
Michael Miller
e3e4cac9c1
Add source to example groups
2019-09-26 16:23:13 -06:00
Michael Miller
dacca0bf1e
Add implicit subject
2019-09-26 16:02:24 -06:00
Michael Miller
a261592776
Add given group
2019-09-26 15:56:48 -06:00
Michael Miller
6ae817d4bc
Add random sample
2019-09-26 15:49:06 -06:00
Michael Miller
3d37a94aaf
Add optional count to sample group
2019-09-26 15:41:58 -06:00
Michael Miller
311b4b0f2f
Use name instead of block_arg
2019-09-26 15:30:29 -06:00
Michael Miller
7e6080aa5f
Move harness out of internals
2019-09-26 15:11:54 -06:00
Michael Miller
0067191423
Remove reference to Internals namespace
2019-09-26 15:11:36 -06:00
Michael Miller
1f300a4a18
Use label in sub-group name
2019-09-26 15:05:28 -06:00
Michael Miller
c3ea34e762
Retrieve test value for sample group
2019-09-26 14:57:31 -06:00
Michael Miller
f6e95719ad
Remove unnecessary quotes in example name
2019-09-26 14:08:17 -06:00
Michael Miller
e5bd582f5f
Handle collection for sample group
2019-09-26 14:05:55 -06:00
Michael Miller
cd0ba81417
Pass test values to test instance
2019-09-26 13:00:23 -06:00
Michael Miller
3c9846ae9b
Remove reference to internals
2019-09-26 12:59:42 -06:00
Michael Miller
5d9e7002d6
Some initial work on sample groups
2019-09-26 12:31:23 -06:00
Michael Miller
422c805e21
Rename SampleValues to TestValues
...
Move out of internal namespace.
2019-09-26 10:26:37 -06:00
Michael Miller
73cef75fcb
Remove dummy example
2019-09-26 09:56:54 -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
3a6fcb9b0d
Fix value negation of attribute matcher
2019-09-23 20:52:03 -06:00
Michael Miller
00d1cd9ea3
Address warnings with return types in generated types
2019-09-23 20:42:04 -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
adbfb7da7c
Use integer division - Crystal 0.31.0 change
2019-09-23 19:38:15 -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
5f3c9d2f63
Distinguish group variables
2019-09-22 11:02:53 -06:00
Michael Miller
24eb5e419a
Get around_each hooks working again
2019-09-18 21:51:35 -06:00
Michael Miller
b17d19689e
Formatting
2019-09-18 09:52:49 -06:00
Michael Miller
db3f89731c
Call parent hooks
2019-09-18 09:51:45 -06:00
Michael Miller
957b8a54db
Implement before and after hooks
2019-09-17 20:58:26 -06:00
Michael Miller
6e1605f246
Add TestContext
2019-09-17 20:57:59 -06:00
Michael Miller
da8736f891
Don't create test as part of run method
2019-09-17 20:37:06 -06:00
Michael Miller
9129aa4286
Use Deque instead of Array
2019-09-17 20:35:19 -06:00
Michael Miller
52ef5e5ced
Some DSL methods for hooks
2019-09-15 10:40:53 -06:00
Michael Miller
7002564ebd
Add let and subject with variants
...
New behavior mimics RSpec - bang variant defines immediately instead of
not storing.
2019-09-15 09:45:48 -06:00
Michael Miller
c94b284ab3
Replace large DSL files with smaller, logical groups
2019-09-15 09:15:33 -06:00
Michael Miller
3f7c16c888
Move all DSL to one module, but separate files
2019-09-13 14:33:46 -06:00
Michael Miller
fafe5606e6
Rename DSL::Builder to SpecBuilder
...
Place all builders under SpecBuilder.
2019-09-13 14:10:25 -06:00
Michael Miller
5d86b4f50e
Get examples working again
2019-09-12 20:26:54 -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
de8f298676
Remove hooks, conditions, and sample vlues (for now)
...
Removed only from examples and example groups.
2019-09-08 10:28:02 -06:00
Michael Miller
e304224bd6
Move stack handling to its own type
2019-09-08 09:59:25 -06:00
Michael Miller
f25eb9164f
Some test creation rewrite
2019-09-08 09:58:15 -06:00
Michael Miller
0706a9986c
Ensure example is set to finished after running
2019-09-06 13:08:41 -06:00
Michael Miller
1c5b46b981
Use fresh variables
2019-09-01 00:54:04 -06:00
Michael Miller
19913a28d1
Gut factories and example structure code
2019-08-31 13:12:40 -06:00
Michael Miller
b8e125e38f
Add test wrapper
2019-08-31 13:12:17 -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
4ecc2c6004
Include ExampleDSL at root
...
Will need to check if methods can run in that scope.
2019-08-30 13:14:48 -06:00
Michael Miller
64045171c2
Change contexts from modules to classes
2019-08-30 12:39:03 -06:00
Michael Miller
6e9633d001
Hacked in double instance creation
2019-08-26 22:48:15 -06:00
Michael Miller
3462bdea1a
Some initial double code
2019-08-26 21:49:47 -06:00
Michael Miller
70e01364ce
Address Ameba issue
2019-08-26 21:11:21 -06:00
Michael Miller
4abf97139b
Experimenting with auto-mocking methods
2019-08-26 21:06:06 -06:00
Michael Miller
325af1f24e
Workaround for Crystal issue
...
Fix for GitHub issue 1 -
https://github.com/icy-arctic-fox/spectator/issues/1
Works around Crystal issue 7060 (6920) -
https://github.com/crystal-lang/crystal/issues/7060
This should be reverted after it is fixed in the Crystal compiler.
2019-08-21 19:26:40 -06:00
Michael Miller
c36859b42b
Correct docs
2019-08-17 08:10:26 -06:00
Michael Miller
7f58c52e43
Cleanup
2019-08-17 08:05:05 -06:00
Michael Miller
498635d288
Pass along a proc to generate the array
...
The "to_a" method is actually dynamically generated.
2019-08-17 08:00:16 -06:00
Michael Miller
43440d37b0
Explicit initializer with sample values
...
Not sure why it isn't getting the one from the module.
2019-08-17 07:59:32 -06:00
Michael Miller
a59e38155e
Defer collection evaluation until build
2019-08-17 07:51:29 -06:00
Michael Miller
34b5487e6f
Pass along class type instead of collection
2019-08-15 17:38:54 -06:00
Michael Miller
01c4b78716
Move placeholder initializer up a level
2019-08-15 16:43:25 -06:00
Michael Miller
b026668de2
Formatting
2019-08-12 14:17:23 -06:00
Michael Miller
46c775932a
Negated all match is not supported
2019-08-12 14:17:04 -06:00
Michael Miller
0cb77b3355
Add all-matcher to DSL
2019-08-12 14:07:13 -06:00
Michael Miller
8520697efa
Initial code for all-matcher
2019-08-12 14:05:14 -06:00
Michael Miller
4e15487a0f
Add relative change matcher
2019-08-11 23:08:45 -06:00
Michael Miller
c19f442e6c
Add #by modifier methods
2019-08-11 13:52:22 -06:00
Michael Miller
848f80ddf8
Add block short-hand syntax support to change matcher
2019-08-11 13:16:40 -06:00
Michael Miller
2666f80653
Hackish fix for block short-hand syntax
...
Dunno when this broke or how it ever worked. 😐
2019-08-11 13:16:18 -06:00
Michael Miller
27436b4e09
Need to use fresh variables in this macro
2019-08-11 12:55:38 -06:00
Michael Miller
5dfcad3cb4
Flip operands of != in case expected has custom logic
2019-08-11 12:40:27 -06:00
Michael Miller
e1a119639f
Add change exact matcher
2019-08-11 12:39:33 -06:00
Michael Miller
3c539b3517
Fix require statements
2019-08-10 12:54:46 -06:00
Michael Miller
1d205b6ee9
Put test expression on its own line
2019-08-10 12:49:54 -06:00
Michael Miller
214b2e171e
Refactor existing change matchers to use new format
2019-08-10 12:42:57 -06:00
Michael Miller
a56d6762c0
Formatting
2019-08-10 11:38:13 -06:00
Michael Miller
535dc6e923
Add change.to variant
2019-08-10 11:37:19 -06:00
Michael Miller
59cf939536
Don't store initial value in matcher
2019-08-10 11:37:19 -06:00
Michael Miller
770100891c
Add change.from variant
2019-08-10 11:36:38 -06:00
Michael Miller
946604b737
Add tests for override cases
...
Fix negated? method.
2019-08-10 11:34:16 -06:00
Michael Miller
24066c46a0
Allow MatchData to control whether they can be negated
...
Values are still negated, but message and matching status are not.
2019-08-10 11:27:15 -06:00
Michael Miller
3e1ee7eb6d
Initial code for basic change matcher
2019-08-10 11:21:14 -06:00
Michael Miller
ede691dd6a
Reorder methods to be in a more standard layout
2019-08-10 11:10:48 -06:00
Michael Miller
898ddcb616
Type annotations for #match?
2019-08-10 10:55:22 -06:00
Michael Miller
c4b886cad2
Add match data docs
2019-08-10 10:53:00 -06:00
Michael Miller
d5fd21702a
Add matcher docs
2019-08-10 10:50:48 -06:00
Michael Miller
37c8dd0865
Stringify respond_to bools
2019-08-10 09:55:26 -06:00
Michael Miller
39f253952d
Add docs and some more type annotations
2019-08-09 17:26:53 -06:00
Michael Miller
db4eaca291
Just assert the return value isn't nil
2019-08-09 17:21:12 -06:00
Michael Miller
efd0ab089d
Define type annotations for match methods
...
Hopefully this speeds up some compilation.
2019-08-09 16:58:35 -06:00
Michael Miller
85b7412436
Fix some more matcher errors
2019-08-09 15:14:00 -06:00
Michael Miller
8fc3af075c
Workaround for NoReturn type for block
...
Not sure if this will work for everything.
It seems that NoReturn shows up as ReturnType (generic) when the
compiler detects the block will raise.
2019-08-09 15:06:22 -06:00
Michael Miller
c47b47ade9
Fix most problems (hopefully) with ExceptionMatcher
2019-08-09 14:18:59 -06:00
Michael Miller
2251168631
Get inspection string of attribute values
2019-08-09 14:01:10 -06:00
Michael Miller
751c15434b
Help infer the block's return type
2019-08-09 11:29:53 -06:00
Michael Miller
e763296c26
Remove inspection quotes from around output values
2019-08-09 11:23:10 -06:00
Michael Miller
0dfde61807
Fix method name matches? -> match?
2019-08-09 11:20:41 -06:00
Michael Miller
5a1dea8f72
Convert bools to strings for output
2019-08-09 11:20:29 -06:00
Michael Miller
3d86893f44
Resolve various duck-typing issues
2019-08-09 11:13:13 -06:00
Michael Miller
114bfa47c2
Genericize TestExpression and make value abstract
...
This seems to resolve issues with the compiler making unions of
unrelated test case types.
2019-08-09 11:12:15 -06:00
Michael Miller
569faa0a2b
Various other fixes
2019-08-09 00:42:39 -06:00
Michael Miller
8b718f0bd0
Handle union case for expected value
...
When using both forms of the HaveMatcher - expected can be a Char,
String, or Regex. Regex is invalid for String#includes?.
I believe this might be a generics issue that was fixed recently in
Crystal.
2019-08-09 00:32:45 -06:00
Michael Miller
353e5f6886
Update formatting to use Tuple
2019-08-08 21:57:02 -06:00
Michael Miller
9dc5a999d1
Fix method name (copy/paste fail)
2019-08-08 21:52:33 -06:00
Michael Miller
3b1a5a1121
Fix various expectation type code
2019-08-08 21:52:05 -06:00
Michael Miller
21e10c1ef2
Fix expected value snapshot
2019-08-08 21:39:30 -06:00
Michael Miller
955311bb95
Don't force Enumerable expected type
...
Should duck type anyway.
2019-08-08 21:38:49 -06:00
Michael Miller
eef7e9ce3c
Wrap expression and label in TestValue
2019-08-08 17:15:13 -06:00
Michael Miller
4665d5f68d
Fix inconsistent naming for test expressions
2019-08-08 17:08:38 -06:00
Michael Miller
2eb51b9c41
Fix type inference in TestValue
2019-08-08 17:05:44 -06:00
Michael Miller
1222e24836
Add missing methods to matchers
...
Fix matcher inheritance.
2019-08-08 17:03:47 -06:00
Michael Miller
9bffb30041
Refactor UnorderedArrayMatcher
2019-08-08 16:59:29 -06:00
Michael Miller
3ae16c6ec1
Refactor predicate and respond matchers
...
Add missing match? method to AttributesMatcher.
2019-08-08 16:47:27 -06:00
Michael Miller
520c738f6a
Refactor RangeMatcher
2019-08-08 16:47:17 -06:00
Michael Miller
cbaa9a4c43
Refactor StartWithMatcher
2019-08-08 16:04:09 -06:00
Michael Miller
a3fa522bd4
Refactor TruthyMatcher
2019-08-08 15:59:31 -06:00
Michael Miller
badccad2fa
Some more easy target refactors
...
EmptyMatcher should extend StandardMatcher.
2019-08-08 15:45:34 -06:00
Michael Miller
17aa472d92
Refactor HaveMatcher
2019-08-08 15:26:30 -06:00
Michael Miller
f1ebce7739
Refactor HaveKeyMatcher and HaveValueMatcher
2019-08-08 15:25:32 -06:00
Michael Miller
7cca43029e
Refactor ExceptionMatcher
2019-08-08 14:20:21 -06:00
Michael Miller
72e5735106
Refactor EndWithMatcher
2019-08-07 00:08:32 -06:00
Michael Miller
f2f46418a3
Refactor collection matcher
2019-08-07 00:07:39 -06:00
Michael Miller
ec96bf2de2
Refactor AttributesMatcher to use new style
2019-08-06 23:35:36 -06:00
Michael Miller
6a317b7a21
Re-add ordering methods
2019-08-06 23:22:50 -06:00
Michael Miller
3314ce8579
Remove ExpectedActual utility class
...
Don't think this is needed anymore.
2019-08-06 23:21:08 -06:00
Michael Miller
98b2cbc9cb
Fix type inference
2019-08-06 23:20:23 -06:00
Michael Miller
436c10cad6
Simplify match data values by using named tuples
2019-08-06 23:13:33 -06:00
Michael Miller
e7b19ee591
Insert StandardMatcher into Matcher hierarchy
...
This is to remove all the unused abstract methods.
2019-08-06 22:33:13 -06:00
Michael Miller
ab147d00fb
Cleanup match methods
2019-08-06 22:18:05 -06:00
Michael Miller
13fad5081b
Initial refactor of ArrayMatcher
2019-08-06 21:56:33 -06:00
Michael Miller
044202e606
Use inspect instead of to_s for value reporting
2019-08-06 21:55:22 -06:00
Michael Miller
5cc735368c
Update comparison matchers
2019-08-01 21:17:24 -06:00
Michael Miller
42b8fe471f
Fix some includes and a dangling old file
2019-08-01 16:37:19 -06:00
Michael Miller
11600a2f8d
Simplify more matchers that are easy targets
2019-08-01 16:35:02 -06:00
Michael Miller
16a2204a2d
Simplify CaseMatcher by using new matcher refactoring
2019-08-01 16:17:39 -06:00
Michael Miller
c75fba8076
Change visibility to private
2019-08-01 16:17:12 -06:00
Michael Miller
4b59dcf142
Pass actual value to failure message methods and values
2019-08-01 16:02:28 -06:00
Michael Miller
f63697b019
Update ValueMatcher to use Matcher's methods
2019-08-01 15:59:29 -06:00
Michael Miller
114a4077f3
Fix parameters on LabeledValue
2019-08-01 15:58:48 -06:00
Michael Miller
f004912fc1
Value first, then label
2019-08-01 15:48:39 -06:00
Michael Miller
7e3b3cd999
Fix namespaces
2019-08-01 15:44:04 -06:00
Michael Miller
99d8f2a845
Use TestValue instead of custom LabeledValue
2019-08-01 15:40:46 -06:00
Michael Miller
763a65beac
Rename again
...
This naming is more appropriate since these types can be used for
expected and actual values.
2019-08-01 15:38:20 -06:00
Michael Miller
dd69cec536
Should capture a block instead of a value
2019-08-01 15:22:45 -06:00
Michael Miller
28680fa849
Rename Actual types to be more "human" sounding
2019-08-01 15:22:18 -06:00
Michael Miller
79a095bb31
Use new style expectations and actuals in DSL
2019-08-01 15:00:56 -06:00
Michael Miller
96c271cf33
No need to shout
2019-08-01 14:46:47 -06:00
Michael Miller
ba1c37b142
Fix macro
2019-08-01 14:46:13 -06:00
Michael Miller
10cf7bbb77
Update Expectation to use new MatchData
2019-08-01 14:05:27 -06:00
Michael Miller
96f2888b88
Fully implement match methods
...
Add placeholders for matcher values.
2019-08-01 14:05:05 -06:00
Michael Miller
acd01a23e6
Re-add MatchData and variants
2019-08-01 14:04:00 -06:00
Michael Miller
ae43c930bf
Replace MatchDataValue types with a single LabeledValue
2019-08-01 13:49:08 -06:00
Michael Miller
43ba4de202
Merge branch 'matcher-refactor-split' into matcher-refactor
2019-07-31 21:04:28 -06:00
Michael Miller
3a7dc7299a
Rewrite ExpectationPartial and remove sub-types
...
The partial now contains the actual and source.
It also calls the correct match method on the matcher and constructs an
expectation (which needs to be updated).
2019-07-31 20:11:30 -06:00
Michael Miller
42b916bdf7
New "actual" types
2019-07-31 20:01:39 -06:00
Michael Miller
e95c81f46e
Pass negation flag to matcher
...
Some matchers need to know if they're negated to work properly and can't
be simply negated afterwards.
2019-07-30 16:19:27 -06:00
Michael Miller
ab1c0269e0
Remove DummyMatchData
...
No longer needed since MatchData was changed to non-abstract.
2019-07-30 16:13:48 -06:00
Michael Miller
a06247bb1e
Change MatchData to Expectation
...
After including negation into matcher logic, these types are equivalent.
2019-07-30 16:11:55 -06:00
Michael Miller
27f844ce25
Remove abstract base match data
...
Switching to a single type that holds the data.Trying to reduce the
number of types and generic types generated.
2019-07-30 16:08:06 -06:00
Michael Miller
c7e6b82a9a
Change wording around let variant
...
The value is set when the expression is run at program startup, not when
the test starts.
2019-07-19 23:10:22 +00:00
Michael Miller
98476057f5
Implement assignment variant of let keyword
...
Resolves #18
2019-07-19 16:44:00 -06:00
Michael Miller
3c7bbe4e42
Allow actual collection to be enumerable, not just array
...
Force expected collection to an array.
2019-06-12 15:36:09 -06:00
Michael Miller
19d52ff02b
Add unordered array matcher
2019-06-12 15:35:33 -06:00
Michael Miller
3ff5b2ac5e
Capture element type
2019-06-12 13:58:11 -06:00
Michael Miller
efde29c90e
Add have_size_of matcher
2019-06-09 12:45:49 -06:00
Michael Miller
bb2b834662
Add have_size matcher
2019-06-09 12:44:46 -06:00
Michael Miller
091cbaa81a
Cleanup have_ variant by using a new matcher
2019-06-01 23:27:16 -06:00
Michael Miller
16bcce59ae
Handle have_
prefix for matcher
2019-06-01 23:14:58 -06:00
Michael Miller
45f0f7f6d1
Include predicate arguments in label
2019-06-01 23:06:39 -06:00
Michael Miller
36f53d82db
Use label from matcher macro
2019-06-01 22:53:12 -06:00
Michael Miller
7e73ec2fe1
Allow passing arguments to predicate matcher
2019-06-01 22:46:06 -06:00
Michael Miller
cc4ab9756a
Fix the actual type reported by the type matcher
...
If an object has a difference between compiler and runtime type, then
the type matcher would report the actual as the compiler type.
The match would be successful, because it uses the runtime check
(is_a?).
2019-06-01 20:48:24 -06:00
Michael Miller
ca564619ad
Change example wrapper type to a class
...
Fixes issue #11 .
Variables (defined with let) were getting re-created between the hooks
and the example code.
This was due to a separate struct value being returned for each fetch to
the wrapped example instance.
In turn, the wrappers for variables were reset for each fetch.
2019-06-01 20:10:08 -06:00
Michael Miller
01b5d71ad0
Fixed an issue where named subjects could crash the compiler
...
Received:
Nil assertion failed (NilAssertionError)
from ???
...
Error: you've found a bug in the Crystal compiler. ...
for this code:
subject(point) { Point.new }
describe "#x" do
subject { point.x }
end
Redefining subjects with a named subject broke.
This commit fixes that with a simply flip in the definitions.
2019-05-21 13:44:19 -06:00
Michael Miller
77307f6eb1
Split part of RangeMatcher off as CollectionMatcher
...
Use CollectionMatcher for `be_within`.
The `#of` method creates a RangeMatcher.
2019-05-16 18:20:08 -06:00
Michael Miller
fa5c13df0e
Remove min-max variation of be_within
...
Use `be_between(min, max)` instead.
This matches RSpec.
2019-05-16 18:09:21 -06:00
Michael Miller
0fc28241dd
Add be_between matcher which is an alias of be_within
2019-05-14 21:50:09 -06:00
Michael Miller
2378594c5d
Use reference matching for be()
2019-05-08 16:59:59 -06:00
Michael Miller
f53bc26c28
Add ReferenceMatcher type
2019-05-08 16:59:36 -06:00
Michael Miller
7168b26218
Remove regex matcher - use case matcher
2019-05-08 16:39:00 -06:00
Michael Miller
6d81e26298
Fix for issue #4
2019-05-08 15:22:32 -06:00
Michael Miller
8480349ff0
Force after_all hooks to run on fail-fast
...
Resolves issues #2 .
2019-04-22 20:29:02 -06:00
Michael Miller
29df8716de
Fixes and tweaks for Crystal 0.28
...
Bump version to 0.5.1
2019-04-18 19:32:24 -06:00
Michael Miller
53bfcc25ef
Add Ameba and address code linting issues
2019-04-06 17:19:02 -06:00
Michael Miller
99926c775e
Fix symbolic not working for short-hand it syntax
2019-04-06 15:21:37 -06:00
Michael Miller
365bd1ec2f
Fix failing tests
2019-04-06 12:48:41 -06:00
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
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
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
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
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