Hello,
I'm new to Chef and Chef testing using ChefSpec.
I've set up my first test with ChefSpec with the following default_spec.rb
require 'chefspec'
require 'spec_helper'
describe 'tesr::default' do
let(:chef_run) {ChefSpec::ChefRunner.new.converge('tesr::default')}
it 'deploy file' do
expect(chef_run).to deploy_deploy("#{ node[:tesr][:rubygem_host]}")
end
end
My default.rb is:
http_deploy "gginfrausermanager-1.0.149" do
url "
http://nuget.prod.praetor.service/artifactory/simple/int-gem/gems"
path node[:tesr][:rubygem_host]
path "/"
end
and in attributes/default.rb:
default[:tesr][:rubygem_host] = "
http://nuget.prod.praetor.service/artifactory/simple/int-gem/gems"
However when I run this ChefSpec test, I get the following error:
Failures:
1) tesr::default deploy file
Failure/Error: let(:chef_run) {ChefSpec::ChefRunner.new.converge('tesr::default')}
NameError:
unintialized constant ChefSpec::ChefRunner
1 example, 1 failure
I have done the following:-
1) installed gem ChefSpec -v 3.1.4 and 4.1.1 (installed 3.1.4 because it was said to fix uninitialized error)
2) have also used ChefSpec::Runner instead of ChefSpec::ChefRunner
3) Chef::Exceptions::CookbookNotFound (Chocolatey cookbook not found even though this cookbook is in Berksfile)
Can anyone throw any light on this?
Many thanks