I am trying to test that linux-image-extra-#{node['kernel']['release']}
will be installed by my cookbook and I'm trying to mock up #{node['kernel']['release']
using Fauxhai. So far I have;
describe 'my-cookbook::recipe' do
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04').converge(described_recipe) }
before do
Fauxhai.mock(platform: 'ubuntu', version: '14.04') do |node|
node['kernel']['release'] = '3.13.0-66'
end
end
it 'installs linux extra image package do'
expect(chef_run).to install_package("linux-image-extra-#{node['kernel']['release']}-generic")
end
end
Unfortunately It isn't picking up the attribute and is producing an error that shows this;
Failure/Error: expect(chef_run).to install_package("linux-image-extra-#{node['kernel']['release']}-generic")