Does anyone know how to mock the node attribute "node.chef_environment" in chefspec?
template 'my_script.sh' do
source 'my_script.erb'
variables(
environment: node.chef_environment
)
end
Unfortunately, mocking via default_attributes does not work.
describe "my_test" do
context "create template file" do
default_attributes['chef_environment']= 'my_env'
it { is_expected.to render_file('my_script.sh').with_content('env=my_env')}
end
end