-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node attributes are not being set. #55
Comments
Also getting this, which might be related. I can't set an attribute that is set as
Here's the spec require 'spec_helper'
describe 'rstudio::server' do
# before do
# Fauxhai.mock(platform: 'ubuntu', version: '12.04') do |node|
# # node['rstudio']['cran']['packages'] = 'aadsf'
# node['languages']['ruby']['version'] = 'ree'
# end
# end
let(:chef_run) do
ChefSpec::Runner.new do |node|
node['rstudio']['cran']['packages'] = 'aadsf'
end.converge(described_recipe)
end
it('should include the r cookbook') do
expect(chef_run).to include_recipe('r')
end
end |
That cookbook you posted is a 404. Since ChefSpec 2.0, you don't ever call fauxhai directly - it's used under the covers. Make a new Chef runner with the platform you want: describe 'rstudio::server' do
let(:chef_run) { ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04').converge(described_recipe) }
it 'includes the r cookbook' do
expect(chef_run).to include_recipe('r')
end
end You can also configure these options globally. All of this is explained in the ChefSpec configuration documentation and ChefSpec attribute setting documentation. |
Ah, got it. 👍 |
Hey there Seth, I pretty much have the same issue as the one above and your solution doesn't seem to help solve the issue. I get
when trying to run: let(:dummy_class) {
Class.new {include Cookbook_name::Helper_module }
ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04') do |node|
node.default.set['Cookbook_name']['attribute_name'] = '/aaa/va/files/'
end.converge(described_recipe)
} and given the stack trace, this is where it fails: it 'should have the directory we are looking for' do
expect(chef_run).to create_directory('/aaa/va/files/')
end any idea what I might be doing wrong? |
I'm a bit perplexed on this one. I'm using the node setting of attributes in other chefspec w/o issue. This is the first time I've used Fauxhai and I'm seeing oddness in that I can't get
node[:platform]
nornode[:kernel][:machine]
to budge fromchefspec
andi386
for the life of me.Here's a gist:
https://gist.github.com/joestump/045969db1928537807d9
When I
puts
mynode[:platform]
(ornode[:kernel][:machine]
) they are never set as I'd expect (should beubuntu
andx86_64
).I was trying to add tests to my rstudio cookbook.
The text was updated successfully, but these errors were encountered: