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

only_with README example doesn't mention namevar is added as a parameter #133

Closed
3flex opened this issue Dec 7, 2013 · 4 comments
Closed
Labels

Comments

@3flex
Copy link
Contributor

3flex commented Dec 7, 2013

A bit of a gotcha with the new only_with matcher (the README and the gh-pages docs examples suffer from this too).

I have this manifest:

user { 'luke':
  ensure => 'present',
  uid    => '501',
}

And this test (from the README):

require 'spec_helper.rb'

describe 'test' do
  it do should contain_user('luke').only_with(
    'ensure' => 'present',
    'uid'    => '501'
  ) end
end

And I get this output:

expected that the catalogue would contain User[luke] with exactly 2 parameters but the catalogue contains 3

I realised that the namevar is added as a parameter. Test should be:

it do should contain_user('luke').only_with(
  'name'   => 'luke',
  'ensure' => 'present',
  'uid'    => '501'
) end

Don't know how best to explain in the docs.

@rodjek
Copy link
Owner

rodjek commented Jan 25, 2014

@3flex what version of Puppet are you testing with?

@3flex
Copy link
Contributor Author

3flex commented Jan 29, 2014

Puppet 3.4.2, though first detected on an earlier version (but I'm not sure which). I put it in a repo so you can have a look: https://github.com/3flex/rspec_puppet_issue_133, with a failing test and a passing test in spec/classes

@3flex
Copy link
Contributor Author

3flex commented Jun 4, 2014

@rodjek do you still need something from me? It's tagged "awaiting feedback".

@alexharv074
Copy link
Contributor

@DavidS looks like this fell into a crack. I just hit this for the first time. I'd be happy to update the documentation, although it looks like a bug to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants