I'm using mock class feature and I found that the parameter value is not useable in the test spec.
class my_class() {
include ref_class
$my_file = "${ref_class::config_dir}/my_config.cfg"
}
here is my test code
require 'spec_helper'
require 'rspec-puppet-utils'
describe 'another_class', :type => :class do
context 'default instantiation' do
describe 'instance class' do
let(:pre_condition) {[
"class ref_class() { $config_dir = '/home/my_user' }",
]}
it { is_expected.to contain_file('/home/my_user/my_config.cfg') }
end
end
end
Then, I executed the test and it shows File[/my_config.cfg] in untouched resources (No prefix path).
NOTES: RSpec gems in my machine.
rspec (3.3.0)
rspec-core (3.4.4, 3.3.2)
rspec-expectations (3.4.0, 3.3.1)
rspec-mocks (3.4.1, 3.3.2)
rspec-puppet (2.2.0)
rspec-puppet-utils (2.2.1)
rspec-support (3.4.1, 3.3.0)
I'm using mock class feature and I found that the parameter value is not useable in the test spec.
here is my test code
Then, I executed the test and it shows File[/my_config.cfg] in untouched resources (No prefix path).
NOTES: RSpec gems in my machine.