Commit Graph

1223 Commits

Author SHA1 Message Date
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
Arina Shmeleva cf448576e2 Add test for subject 2020-01-17 00:49:59 +03:00
Mike Miller d2f0f52729 Merge branch 'specs' into 'master'
Initial RSpec specs and various fixes

See merge request arctic-fox/spectator!24
2020-01-15 03:14:50 +00:00
Michael Miller b25388a165 Merge branch 'specs' of gitlab.com:arctic-fox/spectator into specs 2020-01-14 20:10:53 -07:00
Michael Miller d807f9866a Bump version to 0.9.2 2020-01-14 20:09:15 -07:00
Michael Miller c48b9ed9e1 Resolve let! not working on uninferable types
Resolves https://github.com/icy-arctic-fox/spectator/issues/4
Use ValueWrapper trick again and initialize immediately with before_each 
hook.
2020-01-14 20:07:56 -07:00
Michael Miller d5c5a82395 Add with_message modifier to raise_error matcher 2020-01-06 23:46:38 -07:00
Michael Miller 6a0a73ca76 Add RSpec `match` matcher spec 2020-01-06 23:05:31 -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 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 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 7868755eee Add RSpec `cover` matcher spec 2020-01-05 23:02:09 -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 1d44f582e2 Merge branch 'specs' of gitlab.com:arctic-fox/spectator into specs 2020-01-05 22:30:11 -07:00
Michael Miller 5bbaad36d2 Add RSpec `contain_exactly` matcher spec 2020-01-05 11:42:43 -07:00
Michael Miller 034c1cd6cb Change array matcher to allow any order 2020-01-05 11:42:39 -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 5987574a0e Add RSpec `be_within` matcher spec 2020-01-05 00:42:15 -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 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 2538f3a9a4 Add RSpec predicate matchers spec 2020-01-04 09:58:53 -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 7f8d9d5ef3 Add comparison tests from RSpec docs 2020-01-02 20:00:51 -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 9f91e3a266 Add tests for equality matcher 2020-01-01 21:58:37 -07:00
Michael Miller 681f978df0 Add Guardian config to automatically run specs 2020-01-01 21:50:31 -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 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 a9ac48e12c Merge branch 'mocks-and-doubles' 2019-12-13 20:26:29 -07:00
Michael Miller 612222ace8 Update version to 0.9.1 2019-12-13 20:26:22 -07:00
Michael Miller 8ccc08b472 Fix reflection (verify double) on self arg type
There is still an issue with using _ for a placeholder.
2019-12-13 20:25:18 -07:00
Michael Miller 16625cf495 Registry#expect takes a stub 2019-12-13 19:56:43 -07:00
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