Fix canonicalize_resource to only match resources with same namevar #508
Conversation
9341e04 introduced a regression when using matchers to check that a resource reference doesn't exist, as the matcher will find a resource of the same type but with a different namevar/title. The following example would fail if any `Bar` resource exists, as the title in the `Bar[unknown]` resource reference would be ignored: is_expected.not_to contain_foo("foo").that_requires("Bar[unknown]") The method passed a block to #first rather than #find in order to filter by the namevar, but the block is unused.
When iterating over `@catalogue.resource_keys`, a builtin `Class[main]` resource is returned, but isn't accessible through `#resource`, causing a nil entry in the list of matched resources. The array of resources is now compacted to remove inaccessible builtin resources, which fixes an error when using `Class` resources in relationship matchers.
Changes Unknown when pulling fbac738 on domcleal:fix-negative-relationship-matchers-find-by-title into ** on rodjek:master**. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
9341e04 introduced a regression when using matchers to check that a
resource reference doesn't exist, as the matcher will find a resource of
the same type but with a different namevar/title.
The following example would fail if any
Bar
resource exists, as thetitle in the
Bar[unknown]
resource reference would be ignored:The method passed a block to #first rather than #find in order to filter
by the namevar, but the block is unused.
Fix nil error for irretrievable
Class[main]
resourceWhen iterating over
@catalogue.resource_keys
, a builtinClass[main]
resource is returned, but isn't accessible through
#resource
, causinga nil entry in the list of matched resources. The array of resources is
now compacted to remove inaccessible builtin resources, which fixes an
error when using
Class
resources in relationship matchers.