Comments (4)
Also getting this, which might be related. I can't set an attribute that is set as default['some']['attribute']
without an exception being thrown.
/usr/local/Cellar/ruby/2.0.0-p353/bin/ruby -S rspec ./spec/cran_spec.rb
F
Failures:
1) rstudio::server should include the r cookbook
Failure/Error: node['rstudio']['cran']['packages'] = 'aadsf'
NoMethodError:
undefined method `[]' for nil:NilClass
# ./spec/cran_spec.rb:12:in `block (3 levels) in <top (required)>'
# ./spec/cran_spec.rb:11:in `new'
# ./spec/cran_spec.rb:11:in `block (2 levels) in <top (required)>'
# ./spec/cran_spec.rb:17:in `block (2 levels) in <top (required)>'
Finished in 1.22 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/cran_spec.rb:16 # rstudio::server should include the r cookbook
/usr/local/Cellar/ruby/2.0.0-p353/bin/ruby -S rspec ./spec/cran_spec.rb failed
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
from fauxhai.
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.
from fauxhai.
Ah, got it. 👍
from fauxhai.
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
Failure/Error: ChefSpec::Runner.new do |node|
ArgumentError:
Cannot find a platform for node[fauxhai.local]
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?
Thanks
from fauxhai.
Related Issues (20)
- amazon linux 2016.03 is named wrong HOT 1
- Centos / RHEL 7.3 missing HOT 2
- Incorrect keyword argument name in error message HOT 1
- Chef encountered an error attempting to load the node data for "fauxhai.local" HOT 1
- Update mocked data to match Ohai 13 format HOT 1
- Gather fauxhai mocks for Amazon on Chef 13 HOT 1
- Migrate to chefspec org HOT 5
- Add ability to deprecate old mocked data HOT 1
- Mix of new and old Ohai Filesystem data HOT 1
- Gem specification needs to tighten dependency on Chef HOT 1
- Fauxhai.fetch is giving JSON::ParserError: error HOT 5
- CentOS 7.6 support appears broken / incomplete
- ship minor platform_versions HOT 2
- The OpenSUSE 15.0 platform_family is `null` (fauxhai ingestion needs validation) HOT 1
- Deprecation warning on Ruby 2.7 HOT 2
- open-uri lazy load not working - NoMethodError open for URI:Module HOT 1
- Missing platform data for Windows 11
- Missing platform data for Windows 2022 HOT 1
- Ubuntu 22.04 support HOT 3
- PLEASE open issues and PRs on chef/fauxhai
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fauxhai.