Reputation: 11719
Main
define hello::world {
file { "/tmp/helloworld${name}": }
}
Test
require 'spec_helper'
describe 'hello::world' do
let(:title) { '0' }
context 'test' do
let(:title) { '0' }
it do
should contain_file("/tmp/helloworld0")
end
end
end
at_exit { RSpec::Puppet::Coverage.report! }
Outcome
[user@host] sudo rspec
.
Finished in 0.26947 seconds
1 example, 0 failures
Total resources: 2
Touched resources: 1
Resource coverage: 50.00%
Untouched resources:
hello::world[0]
Multiple sources i.e. 1, 2 and 3 have been read and
it { should contain_define('hello::world[0]') }
or
it { should contain_class('hello::world[0]') }
were added, but the issue persists.
Question
How to touch defines using rspec-puppet?
Upvotes: 0
Views: 279
Reputation: 8223
According to the documentation, you should construct the correct matcher by replacing the colons in the resource type by underscores.
it { should contain_hello__world('0') }
Upvotes: 3