Commit graph

624 commits

Author SHA1 Message Date
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
c18d9c4ffd Allow top-level context macro 2019-04-05 18:38:57 -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
675ef60f9d Consistent version 2019-04-02 22:05:27 -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