HomePhorge

(PUP-3912) Rewrite have_resource matcher for rspec 3
dca5a0f868efUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(PUP-3912) Rewrite have_resource matcher for rspec 3

Previously, the have_resource and be_resource matchers
used instance variables, implicitly assuming they were per-matcher.
However, rspec makes no such guarantees (that I can find) and
under rspec 3 those 'instance variables' were not initialized
at the time of first use.

From a conversation on #rspec, it seems that this behavior
was changed at:
https://github.com/rspec/rspec-expectations/commit/247f8847ab28bbe194abad17bc67ff3a7cc31c59

This commit moves instance variable initialization inside the
individual methods of the matcher.

This commit also removes the be_resource matcher, which was
factored out in an earlier commit but is not currently used (and
not clear if it was ever used). YAGNI. If we need it, we can
add it back, but this is clearer to me.

Details

Provenance
Kylo Ginsberg <kylo@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUab48dd5dda1c: (PUP-3912) Remove unused respond_to? method
Branches
Unknown
Tags
Unknown

Event Timeline

Kylo Ginsberg <kylo@puppetlabs.com> committed rPUdca5a0f868ef: (PUP-3912) Rewrite have_resource matcher for rspec 3 (authored by Kylo Ginsberg <kylo@puppetlabs.com>).Jan 26 2015, 8:52 PM