Commit graph

425 commits

Author SHA1 Message Date
Michael Miller
aa12cdf17c
Introduce non-expectation error ExampleFailed
Used by fail method.
Still todo: Output from failed example is missing because there are no 
expectations.
2021-07-10 03:32:55 -06:00
Michael Miller
6a01ab3531
Merge master into release/0.10 2021-07-05 11:32:45 -06:00
Michael Miller
f728ab6ad7
Add test case handling NoReturn stub and top-level methods (exit)
Fixes https://github.com/icy-arctic-fox/spectator/issues/29
2021-07-02 21:55:42 -06:00
Michael Miller
a0537484f4
Allow creation of doubles without a definition
Utilizes anonymous doubles to implement this.
Fixes https://github.com/icy-arctic-fox/spectator/issues/30
2021-07-02 19:18:14 -06:00
Michael Miller
e3f6fb3c7c
Add no_args support for stubs
Fixes https://github.com/icy-arctic-fox/spectator/issues/28
2021-07-02 18:43:39 -06:00
Michael Miller
dcdc64e134
Specify skip reason 2021-06-11 19:30:23 -06:00
Michael Miller
103597a7be
Update runtime JSON parsing to use new structure 2021-06-02 23:59:42 -06:00
Michael Miller
f24d634ccb
Merge branch 'release/0.10' into specs 2021-04-26 17:19:25 -06:00
Michael Miller
29594eefab
Merge branch 'master' into release/0.10 2021-04-26 11:19:08 -06:00
Michael Miller
93e270f87a
Support variables and methods for type matcher (be_a).
Addresses https://github.com/icy-arctic-fox/spectator/issues/25
2021-04-17 09:38:29 -06:00
Michael Miller
d612657b15
Merge branch 'release/0.10' into specs 2021-03-31 15:28:16 -06:00
Michael Miller
3d702f9bc6
Merge branch 'master' into release/0.10 2021-03-31 15:19:30 -06:00
matthewmcgarvey
91ea9e6cab Comment out failing expectation with reference to open issue 2021-03-30 15:31:23 -04:00
matthewmcgarvey
8fafd2467d Allow matching any line number of example in filter 2021-03-30 00:18:08 -04:00
Michael Miller
79d6ad93b3
Avoid using subject with structs 2021-02-13 17:33:52 -07:00
Michael Miller
4af23751bc
Add specs for value types 2021-02-13 13:30:05 -07:00
Michael Miller
7d5c9edab7
Use cast as workaround 2021-02-13 11:44:51 -07:00
Michael Miller
35946dc993
Test value types 2021-02-09 22:50:21 -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
2c33e96dd4
Fix parsing passing spec 2021-01-30 20:14:25 -07:00
Michael Miller
d3ad0963cd
Minor fixes 2021-01-30 17:31:50 -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
d31b8f4093
Disable false warning from Ameba
spec_helper_path is actually used by the ECR template.
2020-08-16 12:10:32 -06:00
Michael Miller
62fd289b0f
Add ability to test expectations directly 2020-08-16 12:04:45 -06:00
Michael Miller
fab216419c
Capture expectations 2020-08-16 11:39:54 -06:00
Michael Miller
14608c8b2d
Change to struct 2020-08-16 11:00:46 -06:00
Michael Miller
5688e58025
Initial runtime test compilation
Allows for compiling single examples at runtime.
2020-08-16 10:59:15 -06:00
Michael Miller
414f132f49 Add missing require statement 2020-05-09 14:12:40 -06:00
Michael Miller
5c24d606dd Add specs of snippets from docs 2020-03-28 10:50:58 -06: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
83ac420273 Add test for fix, fix test for range_matcher 2020-02-21 13:19:27 +01:00
Michael Miller
cacca99c0b Formatting 2020-01-20 20:32:14 -07:00
Michael Miller
721425c3c8 Run deferred expectations after all hooks 2020-01-20 20:15:49 -07:00
Michael Miller
1e3d89884b Add some RSpec docs tests for hooks 2020-01-20 20:11:19 -07:00
Michael Miller
60f1c3091b Allow be matcher to be used on structs 2020-01-19 22:39:21 -07:00
Michael Miller
3d08949c94 Add helper method specs from RSpec docs 2020-01-19 22:24:28 -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
8381c08b05 Add subject specs 2020-01-19 22:05:38 -07:00
Michael Miller
64f6456935 Merge branch 'specs' 2020-01-19 09:52:41 -07:00
Michael Miller
15f211c4b6 Add it_fails to handle expected failures 2020-01-17 22:41:38 -07:00
Michael Miller
e3a4dedfc6 Add RSpec respond_to matcher spec 2020-01-17 22:14:25 -07:00
Michael Miller
ed48b80d58 Add RSpec raise_error matcher spec 2020-01-17 21:58:29 -07:00
Michael Miller
596f7e87c8 Formatting 2020-01-17 09:27:48 -07:00
Arina Shmeleva
cf448576e2 Add test for subject 2020-01-17 00:49:59 +03:00
Michael Miller
6a0a73ca76 Add RSpec match matcher spec 2020-01-06 23:05:31 -07:00
Michael Miller
b433511201 Add RSpec include/contain matcher spec 2020-01-06 22:51:47 -07:00
Michael Miller
6ad861365c Add RSpec have_attributes matcher spec 2020-01-06 22:33:52 -07:00
Michael Miller
f23141b3e1 Add RSpec start_with and end_with matchers specs 2020-01-06 22:19:09 -07:00
Michael Miller
7868755eee Add RSpec cover matcher spec 2020-01-05 23:02:09 -07:00
Michael Miller
5bbaad36d2 Add RSpec contain_exactly matcher spec 2020-01-05 11:42:43 -07:00
Michael Miller
26656b7c12 Add RSpec change matcher spec 2020-01-05 10:35:35 -07:00
Michael Miller
e17435f6e8 Add RSpec be_within matcher spec 2020-01-05 10:28:21 -07:00
Michael Miller
1f7ac79c78 Add RSpec be matchers spec 2020-01-05 00:29:10 -07:00
Michael Miller
80c4e97c29 Add RSpec all matchers spec 2020-01-05 00:12:57 -07:00
Michael Miller
42ef2cc904 Add RSpec type matchers spec 2020-01-04 12:47:23 -07:00
Michael Miller
2538f3a9a4 Add RSpec predicate matchers spec 2020-01-04 09:58:53 -07:00
Michael Miller
7f8d9d5ef3 Add comparison tests from RSpec docs 2020-01-02 20:00:51 -07:00
Michael Miller
9f91e3a266 Add tests for equality matcher 2020-01-01 21:58:37 -07:00
Michael Miller
0a6493964d Allow auto-run of Spectator
Needed to test Spectator with itself.
2020-01-01 21:50:08 -07:00
Michael Miller
2c400950a4 Remove specs since they're mostly invalidated by the refactor 2019-09-26 20:52:26 -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
cede88bf0c Update spec with new arguments 2019-08-17 08:24:06 -06:00
Michael Miller
a54e406fec Clean up expectation specs
Removed tests that are no longer valid or non-trivial to update.
2019-08-09 15:32:22 -06:00
Michael Miller
251e3b8774 Remove specs for matchers
Will replace with Spectator-based tests later.
2019-08-09 15:16:01 -06:00
Michael Miller
19d52ff02b Add unordered array matcher 2019-06-12 15:35:33 -06:00
Michael Miller
0eaf8efcc6 Fix copy/paste fail 2019-06-12 13:57:33 -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
0164d2973f Fix predicate tests and add new ones for have_ variant 2019-06-01 23:39:23 -06:00
Michael Miller
e234ac2f31 Test case to ensure runtime type is reported 2019-06-01 20:55:29 -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
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
00045ba9be Tests for nested groups and fail-fast 2019-04-22 20:27:54 -06:00
Michael Miller
1d530de5b1 Add tests for fail-fast and after hooks
Inspecting issue #2
2019-04-22 19:12:45 -06:00
Michael Miller
b305c829be Allow hooks and conditions to be passed to create 2019-04-22 18:22:12 -06:00
Michael Miller
3eb6a1d676 Remove unused block arguments 2019-04-06 17:20:12 -06:00
Michael Miller
53bfcc25ef Add Ameba and address code linting issues 2019-04-06 17:19:02 -06:00
Michael Miller
365bd1ec2f Fix failing tests 2019-04-06 12:48:41 -06:00
Michael Miller
2ea69d2355 Add spec for 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
aabc25ad4f Change formatters to take nillable profile 2019-03-25 16:05:38 -06:00
Michael Miller
35b887f8f0 Add placeholders for profile functionality 2019-03-25 12:13:11 -06:00
Michael Miller
2ff9505766 Add filter to TestSuite 2019-03-25 11:35:39 -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
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
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
209ef92d3d Implement "fail-blank" into runner and report 2019-03-22 13:41:46 -06:00
Michael Miller
2b71400d9a Remove tests that had a prefixed actual value 2019-03-22 13:05:24 -06:00
Michael Miller
c156c55c72 Inspect the underlying value
This is needed because MatchDataValue is now a class instead of a 
struct.
2019-03-22 11:55:04 -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
3dd39f17f5 Fix Expectation spec 2019-03-22 11:07:56 -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
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
f2558fd09e Add spec for ExceptionMatcher 2019-03-21 22:50:02 -06:00
Michael Miller
d0da584f5e Add tests for Color formatting module 2019-03-14 19:42:30 -06:00
Michael Miller
0ca0ba0a55 Fix tests to account for negation wrappers 2019-03-07 16:12:23 -07:00
Michael Miller
a9d1f1aabc Workaround for mashup of compile-time types 2019-03-06 18:40:57 -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
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
0288e1d6f8 Add tests for match data values 2019-03-05 14:00:14 -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
1db5341f4b Add tests for match data values 2019-03-03 19:31:39 -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
ec06daaf35 Test values returned by match data 2019-03-03 12:13:35 -07:00
Michael Miller
daf2f43f25 Rename module from Formatters to Formatting 2019-02-28 19:14:03 -07:00
Michael Miller
4e3290ebfe Initial code to get match data values to output
Expose the match data values through the Expectation class.
2019-02-28 16:35:50 -07:00
Michael Miller
6942e70024 Remove unnecessary type specification 2019-02-28 15:18:56 -07:00
Michael Miller
65dd6243dd Rename to match class name 2019-02-28 15:17:50 -07:00
Michael Miller
5ba03a90ff Swap label and expected value parameters
This matches the partial initializer parameters.
Also cleaned up some code in the Expectation spec.
2019-02-28 15:17:12 -07:00
Michael Miller
b4af87f903 Fix fallout from last commit in Expectation spec
All tests pass in this commit!
2019-02-28 13:52:01 -07:00
Michael Miller
e6ce54202d Remove Matcher methods moved to MatchData
Update spec for EqualityMatcher to reflect this.
2019-02-28 13:47:50 -07:00
Michael Miller
94cbb9860a Update NilMatcher to use MatchData and #match 2019-02-28 11:31:05 -07:00
Michael Miller
0dd66c8803 Update Expectation spec to use new parameters 2019-02-28 11:07:16 -07:00
Michael Miller
26187a0f31 Fix oddity with type being unresolvable 2019-02-27 22:20:57 -07:00
Michael Miller
c1f61d68bf Use MatchData 2019-02-26 20:29:04 -07:00
Michael Miller
e92b1dc466 Add #failed? method to Report 2019-02-22 15:09:55 -07:00
Michael Miller
919e2b96f6 Update specs for new Result#call functionality 2019-02-20 21:17:27 -07:00
Michael Miller
a015f30769 Add tests for Source#spec and update #to_s tests 2019-02-17 21:24:31 -07:00
Michael Miller
dc7d5fbe25 Lazy iterate over failures and errors
Return iterator from #failures and #errors methods in Report.
Update spec to reflect this.
2019-02-17 20:09:13 -07:00
Michael Miller
6cc3c5e20b Add tests for adding/omitting the space in #to_s 2019-02-17 17:03:57 -07:00
Michael Miller
fe083b0f74 Update specs to handle and test symbolic components 2019-02-17 16:39:23 -07:00
Michael Miller
6a8d447570 Add tests for Result#call implementations 2019-02-17 14:40:05 -07:00
Michael Miller
0b06e72f7e Simplify method chains by using #compact_map 2019-02-17 13:40:10 -07:00
Michael Miller
5722d18db9 Update or remove tests using result predicate methods 2019-02-17 13:35:24 -07:00
Michael Miller
ed01a95e67 Replace source file and line with source struct 2019-02-17 12:40:16 -07:00
Michael Miller
ffca0316a4 Add spec for source class 2019-02-17 12:32:15 -07:00
Michael Miller
7504536528 Remove conflicting duplicate #new_pending_result 2019-02-15 22:19:34 -07:00
Michael Miller
88c32b697b Add tests for source file and line 2019-02-14 19:35:42 -07:00
Michael Miller
1507a447c8 Update specs to use new source arguments
Used `new_partial` where the underlying partial didn't matter for the
test.
2019-02-14 17:04:59 -07:00
Michael Miller
36c98db0ae Update spec helpers to have source information 2019-02-14 15:41:59 -07:00
Michael Miller
f19b33d7a2 Add spec for Report and fix some bugs 2019-02-14 14:25:46 -07:00
Michael Miller
6151912fa6 Add spec for test suite 2019-02-12 22:33:48 -07:00
Michael Miller
493e30acee Remove elapsed time from pending results 2019-02-12 16:36:06 -07:00
Michael Miller
577877e067 Add spec for runner
Added a spy for detecting when formatter methods are called.
2019-02-12 16:10:14 -07:00
Michael Miller
50bc1af816 Method for creating groups of spy examples 2019-02-12 13:45:19 -07:00
Michael Miller
1f2f7f2214 Add spec for have_value matcher 2019-02-05 19:37:41 -07:00
Michael Miller
da9e653a89 Add spec for have_key matcher 2019-02-05 19:26:46 -07:00
Michael Miller
8a09ddac04 Add spec for predicate matcher 2019-02-05 10:36:59 -07:00
Michael Miller
5da222d7a0 Whitespace 2019-02-04 16:27:40 -07:00
Michael Miller
71427e4f6b Use spy to test that matchers use === operator 2019-02-04 16:26:53 -07:00
Michael Miller
e42e5b30bb Fix test 2019-02-04 16:20:35 -07:00
Michael Miller
75c4bcad54 Add spec for have_attributes matcher 2019-02-04 16:19:39 -07:00
Michael Miller
ade4af0153 Add tests for multiple arguments 2019-02-01 20:44:25 -07:00
Michael Miller
239779135f Fix have matcher tests for multiple arguments 2019-02-01 20:29:13 -07:00
Michael Miller
4043a76a07 Add tests for multiple arguments 2019-02-01 19:56:46 -07:00
Michael Miller
acea12cafb Fix contain matcher tests for multiple arguments 2019-02-01 19:45:30 -07:00
Michael Miller
196b4d97a5 Add spec for have matcher 2019-02-01 16:43:18 -07:00
Michael Miller
2a91191a6b Add spec for contain matcher 2019-01-31 23:12:48 -07:00
Michael Miller
5f9c0385ad Check for mentions of first and last 2019-01-31 22:13:50 -07:00
Michael Miller
a91758b3f3 Add spec for end_with matcher 2019-01-31 22:11:38 -07:00
Michael Miller
e6e4f28a4c Add spec for start_with matcher 2019-01-31 19:36:35 -07:00
Michael Miller
3731b6d785 Remove BlockExpectation 2019-01-31 13:32:34 -07:00
Michael Miller
ff4e148509 Rename ValueExpectation to Expectation in tests 2019-01-31 13:30:09 -07:00
Michael Miller
2863ae7dfe Add spec for block expectation and partial 2019-01-28 16:03:33 -07:00
Michael Miller
651127f2d4 Add spec for empty matcher
Mark question matchers as done (for now).
More may be added later if they're common.
2019-01-26 17:09:24 -07:00
Michael Miller
aa94ec0e33 Sub-types should be not match 2019-01-26 16:44:46 -07:00
Michael Miller
3bfaa07d4f Add spec for nil matcher 2019-01-26 16:41:21 -07:00
Michael Miller
c3d7aef7a9 Add a couple of type tests 2019-01-26 16:34:58 -07:00
Michael Miller
12864492b7 Add spec for range modifier methods 2019-01-25 13:52:41 -07:00
Michael Miller
ac08806010 Add spec for RangeMatcher 2019-01-25 13:12:34 -07:00
Michael Miller
6a91b3e399 Formatting 2019-01-25 11:09:11 -07:00
Michael Miller
e33ce5c182 Implement remaining pending tests 2019-01-25 11:08:57 -07:00
Michael Miller
6665e4d396 Implement some pending tests 2019-01-24 22:36:05 -07:00
Michael Miller
cbb4c18668 Formatting 2019-01-23 23:16:18 -07:00
Michael Miller
a869d4f23f More pending tests to implement 2019-01-23 23:14:34 -07:00
Michael Miller
f0a972ed06 Start on some condition tests 2019-01-23 23:01:16 -07:00
Michael Miller
c31557e8ff Move everything in BeComparison to TruthyMatcher
This is to match RSpec's ability to use "be" by itself.
For instance: `expect(foo).to be`
2019-01-23 22:10:03 -07:00
Michael Miller
2758ba7643 Add spec for BeComparison 2019-01-23 21:36:52 -07:00
Michael Miller
f09aaf59e6 Formatting 2019-01-23 21:11:01 -07:00
Michael Miller
06ee53a7b6 Add spec for GreaterThanEqualMatcher 2019-01-23 21:10:17 -07:00
Michael Miller
e3d9b55ae7 Add spec for GreaterThanMatcher 2019-01-23 21:08:52 -07:00