Commit graph

817 commits

Author SHA1 Message Date
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
ae18316a5a Update README with implemented matchers 2019-07-19 17:14:13 -06:00
Mike Miller
95f730965c Merge branch 'let-assignment-variant' into 'release/0.8'
Change wording around let variant

See merge request arctic-fox/spectator!12
2019-07-19 23:11:42 +00: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
Mike Miller
31fb1c3e81 Merge branch 'let-assignment-variant' into 'release/0.8'
Implement assignment variant of let keyword

See merge request arctic-fox/spectator!11
2019-07-19 22:49:09 +00:00
Michael Miller
98476057f5 Implement assignment variant of let keyword
Resolves #18
2019-07-19 16:44:00 -06:00
Mike Miller
855c713c5e Merge branch 'any-order-matcher' into 'release/0.8'
Any order matcher

See merge request arctic-fox/spectator!9
2019-06-12 21:40:03 +00: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
0eaf8efcc6 Fix copy/paste fail 2019-06-12 13:57:33 -06:00
Mike Miller
05075696bc Merge branch 'size-of-matcher' into 'release/0.8'
Size of matcher

See merge request arctic-fox/spectator!8
2019-06-09 19:04:06 +00: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
Mike Miller
bc4d0117a3 Merge branch 'have-matcher' into 'release/0.8'
Implement have predicate matcher

See merge request arctic-fox/spectator!6
2019-06-02 05:46:27 +00:00
Michael Miller
7a8cf08c73 Update README (matchers) 2019-06-01 23:41:06 -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
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
d969b0557a Update version to 0.8.0 2019-06-01 22:27:51 -06:00
Mike Miller
2eb6bc4ea2 Merge branch 'type-matcher-actual-fix' into 'release/0.8'
Fix the actual type reported by the type matcher

See merge request arctic-fox/spectator!5
2019-06-02 03:37:41 +00:00
Michael Miller
e234ac2f31 Test case to ensure runtime type is reported 2019-06-01 20:55:29 -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
Mike Miller
b6ac736dd2 Merge branch 'issue-11-fix' into 'master'
Issue 11 fix

Closes #11

See merge request arctic-fox/spectator!4
2019-06-02 02:12:24 +00:00
Michael Miller
c744120e91 Update version to 0.7.2 2019-06-01 20:10:27 -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
Mike Miller
ed2614da22 Merge branch 'named-subject-fix' into 'master'
Named subject fix

See merge request arctic-fox/spectator!3
2019-05-21 19:48:30 +00:00
Michael Miller
64a3a81b15 Update version to 0.7.1 2019-05-21 13:45:39 -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
ec9e598882 Update version to 0.7.0 2019-05-16 18:25:12 -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
Mike Miller
29abe79809 Merge branch 'equality-matcher-changes' into 'master'
Equality matcher changes

See merge request arctic-fox/spectator!2
2019-05-09 01:21:22 +00:00
Michael Miller
7e20521030 Bump to 0.6.0
Breaking change with be() and match()
2019-05-08 17:02:30 -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
Mike Miller
e4ec47f413 Merge branch 'exception-matcher-args-fix' into 'master'
Exception matcher args fix

Closes #4

See merge request arctic-fox/spectator!1
2019-05-08 21:27:56 +00:00
Michael Miller
725f83ebca Bump version to 0.5.3 2019-05-08 15:22:51 -06:00
Michael Miller
6d81e26298 Fix for issue #4 2019-05-08 15:22:32 -06:00