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

#subject method no longer exists #235

Closed
jhoblitt opened this issue Nov 18, 2014 · 3 comments
Closed

#subject method no longer exists #235

jhoblitt opened this issue Nov 18, 2014 · 3 comments

Comments

@jhoblitt
Copy link
Contributor

It appears that the #subject alias to #catalogue was removed in 34220fc . This breaks fairly idiomatic usage of puppetlabs_spec_helper's #verify_contents. I assume this was done so as not to conflict with a rspec-core usage of #subject? In any event, this happened without a deprecation warning. I've opened a bug on https://tickets.puppetlabs.com/browse/MODULES-1514 as well.

The fix is to replace subject with catalogue in the invocation of #verify_contents.

@jhoblitt
Copy link
Contributor Author

Also worth mentioning, replacing usage of subject with catalogue does not work with the released version of rspec-puppet 1.0.1. It's currently not possible to be compatible with both 1.0.1 and 1.0.1+ without writing your own shim methods.

jhoblitt added a commit to jhoblitt/puppet-smartd that referenced this issue Nov 18, 2014
The verify_contents method invocations have been updated to work with
rspec-puppet 1.0.1+ but are now incompatible with <= 1.0.1
rodjek/rspec-puppet#235
jhoblitt added a commit to jhoblitt/puppet-ksm that referenced this issue Nov 18, 2014
The verify_contents method invocations have been updated to work with
rspec-puppet 1.0.1+ but are now incompatible with <= 1.0.1
rodjek/rspec-puppet#235
jhoblitt added a commit to jhoblitt/puppet-autofsck that referenced this issue Nov 19, 2014
The verify_contents method invocations have been updated to work with
rspec-puppet 1.0.1+ but are now incompatible with <= 1.0.1
rodjek/rspec-puppet#235
jeffmccune pushed a commit that referenced this issue Dec 2, 2014
This patch bumps the version of rspec-puppet to 2.0.0.  A new major
version is warranted because of the following changes noted by Joshua
Hoblitt.

There were several small bits of breakage and most (all?) of my modules
required forward porting work.

Some tests still had include_class, which I believe was long deprecated
anyways.

 * I ended up pinning the version of rspec-core as gem 'rspec-core', '~> 2.0'
   to silence rspec 3 warnings. It would be nice if a new release set this
   requirement it it's gemspec.

 * It looks like libdir handling changes broke rspec-puppet-augeas
   domcleal/rspec-puppet-augeas#15

 * All instances of verify_contents(subject, ...) broke as subject has been
   removed and replaced with catalogue. #235

 * The construct I had been using to check for exceptions in negative tests
   broke. expect { should }.to raise_error(...) had to be replaced with should
   raise_error(...)

The last 2-3 are definitely breaking changes from 1.0.0 and I believe this
warrants a major version bump. Otherwise, I expect 'rspec-puppet', '~> 1.0'
will still break a number of module's tests.
razorsedge added a commit to razorsedge/puppet-network that referenced this issue Feb 7, 2015
razorsedge added a commit to voxpupuli/puppet-snmp that referenced this issue Feb 7, 2015
razorsedge added a commit to razorsedge/puppet-tor that referenced this issue Feb 7, 2015
razorsedge added a commit to razorsedge/puppet-tripwire that referenced this issue Feb 7, 2015
razorsedge added a commit to voxpupuli/puppet-vmwaretools that referenced this issue Feb 7, 2015
razorsedge added a commit to razorsedge/puppet-hp_spp that referenced this issue Feb 7, 2015
razorsedge added a commit to razorsedge/puppet-hp_mcp that referenced this issue Feb 7, 2015
@DavidS
Copy link
Collaborator

DavidS commented Jun 30, 2015

Is there a reason those tests do not use is_expected.to contain_file(config_file).with_content(content) (example from jhoblitt/puppet-smartd@e80c3aa)? That is rspec-puppet only, gives you the same semantic (unless I'm missing something) and will give you a nice diff on mismatches.

@jhoblitt
Copy link
Contributor Author

@DavidS As to using the implicit receiver instead of is_expected.to, the module/tests predate rspec 3. #with_content is not exactly equivalent to #verify_contents in that the later allows you to specify only the lines you want to ensure are present. AFAIK, #with_content doesn't work with an array of match patterns but it would be trivial to write a helper method around it. #verify_contents was fairly idiomatic several years ago but I don't see it much anymore.

I'm not sure if any action is needed at this point since there has been a major API bump since I opened this issue.

@rodjek rodjek closed this as completed Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants