#set cookbook path relative to this file
cpath = File.expand_path("../../../", __FILE__)
Hi I'm trying to write a unit tests using ChefSpec (and Chef Solo) but I can't get even the simplest test to work. I've tried following several examples but always get a Chef::Exceptions::CookbookNotFound error on the cookbook I'm attempting to test.For example if I add the following to the 'java' cookbook (http://community.opscode.com/cookbooks/java)# coobooks/java/spec/default_spec.rbrequire 'chefspec'describe 'java::default' dolet(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }it 'should include the openjdk recipe by default' dochef_run.should include_recipe 'java::openjdk'endendWhen I run rspec I get the following error:Failures:
1) java::default should include the openjdk recipe by defaultFailure/Error: let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }Chef::Exceptions::CookbookNotFound:Cookbook java not found. If you're loading java from another cookbook, make sure you configure the dependency in your metadata# ./cookbooks/java/spec/default_spec.rb:4:in `block (2 levels) in <top (required)>'# ./cookbooks/java/spec/default_spec.rb:6:in `block (2 levels) in <top (required)>'Finished in 0.035 seconds1 example, 1 failureFailed examples:rspec ./cookbooks/java/spec/default_spec.rb:5 # java::default should include the openjdk recipe by defaultI've tried running the following commands but they both result in this error:rspec cookbooks\javarspec cookbooks\java\spec\default_spec.rbI've tried adding a .chef/knife.rb as detailed here https://wiki.opscode.com/display/chef/Troubleshooting+and+Technical+FAQ) but that didn't help.
The ChefSpec readme (https://github.com/sethvargo/chefspec) mentions BerkShelf and Librarian. I don't currently use either of those tools, do I need them to run ChefSpec?Am I missing something obvious (I'm new to Chef and Ruby)?Thanks, Richard.
Archive powered by MHonArc 2.6.16.