0
define hello::world {
file { "/tmp/helloworld${name}": }
}
測試
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! }
成果
[[email protected]] 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]
it { should contain_define('hello::world[0]') }
或
it { should contain_class('hello::world[0]') }
,但問題仍然存在。
問題
如何使用rspec的木偶碰定義?