Commit graph

290 commits

Author SHA1 Message Date
Michael Miller
edb20e5b2f
Additional handling when comparing ranges against unexpected types 2024-01-27 11:25:59 -07:00
Michael Miller
b5fbc96195
Allow matchers to be used in case equality 2024-01-27 11:17:19 -07:00
Michael Miller
726a2e1515
Add non-captured block argument
Preparing for Crystal 1.8.0
https://github.com/crystal-lang/crystal/issues/8764
2023-01-26 17:19:31 -07:00
Michael Miller
318e4eba89
Use shorter string when stub is treated as a message 2022-11-04 22:55:12 -06:00
Michael Miller
6e7d215f69
Add type annotations to to_s and inspect 2022-11-04 20:56:02 -06:00
Michael Miller
ccdf9f124b
Add require statements and namespace Value
When defining a matcher outside of the `Spectator` module (custom matcher), `Value(ExpectedType)` can't be resolved.
I suspect this is a Crystal compiler bug, since a derived class should not affect lookups of parent classes like this.
Require statements are added to (hopefully) ensure `Spectator::Value` is defined for the initializer.
Related to https://github.com/icy-arctic-fox/spectator/issues/46
2022-09-03 16:46:17 -06:00
Michael Miller
7e09016e5c
Add count modifiers for have_received matcher 2022-07-14 20:46:52 -06:00
Michael Miller
e29c732d0f
Add count to ReceiveMatcher 2022-07-13 16:48:38 -06:00
Michael Miller
181a34a0b3
Display "None" when no methods are called 2022-07-13 10:53:57 -06:00
Michael Miller
4b2b37477e
Remove unused methods 2022-07-12 18:04:55 -06:00
Michael Miller
d7ea969f55
Pretify stub and call output
Fix some tests.
2022-07-12 17:47:05 -06:00
Michael Miller
694e2e6259
Initial implementation of have_received 2022-07-11 20:25:15 -06:00
Michael Miller
70391b2d31
Fix warnings from Crystal 1.5.0 regarding positional parameters 2022-07-07 18:10:21 -06:00
Michael Miller
0704fd2a48
Adjust evaluation order of change matcher expressions
Handles reference types better and matches RSpec more closely.
2022-05-14 23:30:15 -06:00
Michael Miller
8ac6546bdd
Rip out more existing mocks 2022-02-28 22:15:29 -07:00
Michael Miller
59ce312341
Fix typos and spelling 2021-11-28 15:45:17 -07:00
Michael Miller
a95c5bcab7
Better handling with be match against Value types and nil
Releates to https://github.com/icy-arctic-fox/spectator/issues/37
2021-09-28 18:22:41 -06:00
Michael Miller
99ced17516
Handle undefined methods with have_attributes matcher
Instead of producing a compilation error on missing/undefind methods, 
substitute in an "undefined" value.
This shows better output to the user.
2021-09-26 12:50:17 -06:00
Michael Miller
2f1ac1374b
Use RegexMatcher to force used =~ operator 2021-09-22 17:57:56 -06:00
Michael Miller
64b9c13436
Remove Test prefix 2021-09-22 17:53:42 -06:00
Michael Miller
708fd692ae
Add actual label to match data description 2021-08-19 11:46:07 -06:00
Michael Miller
99378c0f36
Merge branch 'release/0.10' into reporting 2021-05-19 20:15:51 -06:00
Michael Miller
a3305a9273
Merge branch 'master' into release/0.10 2021-05-19 20:15:36 -06:00
Michael Miller
e3576c8924
Add support for be === and be =~
Addresses https://github.com/icy-arctic-fox/spectator/issues/26
2021-05-19 19:46:46 -06:00
Michael Miller
5da21f8ede
Update Ameba and address issues 2021-05-15 19:51:44 -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
08451df643
Add matcher to check compiled type of values 2021-02-12 18:33:50 -07:00
Michael Miller
4500ebcddc
Update old references to Value and Block 2021-01-16 11:02:29 -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
875ca587f3
Show missing values in error output 2020-12-23 13:44:12 -07: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
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
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
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
Michael Miller
d30e65ee2d Missing ? on method name check 2020-01-20 20:42:16 -07:00
Michael Miller
60f1c3091b Allow be matcher to be used on structs 2020-01-19 22:39:21 -07:00
Michael Miller
a2508d5f6b Fix negation case for respond_to matcher 2020-01-17 22:08:52 -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