CookbookNotFound - ChefSpec


#1

Hi there,

I’m hoping that someone could help me.

I’m testing a Chef recipe with ChefSpec 3.2 and Chef 11.6. However when I run my test recipe, I have the following errors:-

All examples were filtered out; ignoring {:focus=>true}
[2015-04-27T13:20:24+01:00] WARN: found a directory files in the cookbook path, but it contains no cookbook files. skipping.
[2015-04-27T13:20:24+01:00] WARN: found a directory test in the cookbook path, but it contains no cookbook files. skipping.
F

Failures:

  1. gg-ops-dashing::install installs ruby 1.9.3 package
    Failure/Error: let(:chef_run) { runner.converge ‘gg-ops-dashing::install’ }
    Chef::Exceptions::CookbookNotFound:
    Cookbook gg-ops-dashing not found. If you’re loading gg-ops-dashing from another cookbook, make sure you configure the dependency in your metadata

    ./spec/install_spec.rb:13:in `block (2 levels) in <top (required)>’

    ./spec/install_spec.rb:17:in `block (2 levels) in <top (required)>’

Finished in 0.27571 seconds
1 example, 1 failure

require 'spec_helper’
require ‘chefspec’

#install_spec.rb
describe ‘gg-ops-dashing::install’ do

let(:runner) do
	cookbook_paths = %W(#{File.expand_path(Dir.pwd)} #{File.expand_path("..", Dir.pwd)})
	ChefSpec::Runner.new({cookbook_path: cookbook_paths})
end

let(:chef_run) { runner.converge ‘gg-ops-dashing::install’ }

it 'installs ruby 1.9.3 package' do

  expect(chef_run).to install_package('ruby1.9.3')

end	

end

Can someone please tell me where I’m going wrong?

Thanks,

Angela

Sent from iCloud


#2

That looks like ChefSpec telling you what to fix in the cookbook you ran it
on.

Do you have *depends ‘gg-ops-dashing’ *in the metadata.rb of the cookbook
you ran the test against?

On Mon, Apr 27, 2015 at 5:29 AM, ANGELA EBIRIM aebirim@icloud.com wrote:

Hi there,

I’m hoping that someone could help me.

I’m testing a Chef recipe with ChefSpec 3.2 and Chef 11.6. However when I
run my test recipe, I have the following errors:-

All examples were filtered out; ignoring {:focus=>true}
[2015-04-27T13:20:24+01:00] WARN: found a directory files in the cookbook
path, but it contains no cookbook files. skipping.
[2015-04-27T13:20:24+01:00] WARN: found a directory test in the cookbook
path, but it contains no cookbook files. skipping.
F

Failures:

  1. gg-ops-dashing::install installs ruby 1.9.3 package
    Failure/Error: let(:chef_run) { runner.converge
    ’gg-ops-dashing::install’ }
    Chef::Exceptions::CookbookNotFound:
    Cookbook gg-ops-dashing not found. If you’re loading gg-ops-dashing
    from another cookbook, make sure you configure the dependency in your
    metadata

    ./spec/install_spec.rb:13:in `block (2 levels) in <top (required)>’

    ./spec/install_spec.rb:17:in `block (2 levels) in <top (required)>’

Finished in 0.27571 seconds
1 example, 1 failure

require 'spec_helper’
require ‘chefspec’

#install_spec.rb
describe ‘gg-ops-dashing::install’ do

let(:runner) do
cookbook_paths = %W(#{File.expand_path(Dir.pwd)}
#{File.expand_path("…", Dir.pwd)})
ChefSpec::Runner.new({cookbook_path: cookbook_paths})
end

let(:chef_run) { runner.converge ‘gg-ops-dashing::install’ }

it 'installs ruby 1.9.3 package' do

  expect(chef_run).to install_package('ruby1.9.3')

end

end

Can someone please tell me where I’m going wrong?

Thanks,

Angela

Sent from iCloud


Yoshi Spendiff
Ops Engineer
Indochino
Mobile: +1 778 952 2025
Email: yoshi.spendiff@indochino.com