Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix canonicalize_resource to only match resources with same namevar #508

Conversation

@domcleal
Copy link
Contributor

@domcleal domcleal commented May 2, 2017

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.


Fix nil error for irretrievable Class[main] resource

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.

domcleal added 2 commits May 2, 2017
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.
@coveralls
Copy link

@coveralls coveralls commented May 2, 2017

Coverage Status

Changes Unknown when pulling fbac738 on domcleal:fix-negative-relationship-matchers-find-by-title into ** on rodjek:master**.

@DavidS DavidS merged commit 34c9e2c into rodjek:master May 5, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rodjek rodjek added the bugfix label Aug 13, 2017
@rodjek rodjek added this to the 2.6.0 milestone Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants