$ puppet module generate --skip-interview poc-filez class filez {
file { $title:
# have also tried "${title}"
ensure => "present",
}
}
require 'spec_helper'
describe 'filez' do
expected_title = '/home/me/foo'
let(:title) { expected_title }
# have tried variations, e.g. let (:title) { "#{expected_title" }
# this fails
it { should contain_file("#{expected_title}") }
# but when I use the module name, it passes, File[filez] is in the catalog
# it { should contain_file("filez") }
endfixtures:
repositories:
#
symlinks:
filez: "#{source_dir}"
$ rake spec
Failures:
1) filez should contain File[/home/me/foo]
Failure/Error: it { should contain_file("#{expected_title}") }
expected that the catalogue would contain File[/home/me/foo]class filez {
file { $name:
ensure => "present",
}
}require 'spec_helper'
describe 'filez' do
expected_title = '/home/me/foo'
let(:params) {{ :name => expected_title }}
# this passes
it { should contain_file("#{expected_title}") }
# this fails
# it { should contain_file("filez") }
endGEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.2.8)
diff-lcs (1.2.5)
facter (2.3.0)
CFPropertyList (~> 2.2.6)
hiera (1.3.4)
json_pure
json_pure (1.8.1)
metaclass (0.0.4)
mocha (1.1.0)
metaclass (~> 0.0.1)
puppet (3.7.3)
facter (> 1.6, < 3)
hiera (~> 1.0)
json_pure
puppet-lint (1.1.0)
puppet-syntax (1.3.0)
rake
puppetlabs_spec_helper (0.8.2)
mocha
puppet-lint
puppet-syntax
rake
rspec
rspec-puppet
rake (10.4.2)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-puppet (1.0.1)
rspec
rspec-support (3.1.2)
PLATFORMS
ruby
DEPENDENCIES
facter (>= 1.7.0)
puppet (>= 3.3)
puppet-lint (>= 0.3.2)
puppetlabs_spec_helper (>= 0.1.0)--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/39cf1edd-aa4f-4370-8674-4b041e4cfa86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I'd probably recommend trying to write a test for one of your
real-world puppet modules as I think the issue is with the Puppet code
more than the tests.