I am getting chefspec error as shown in title. Below are recipe resource and spec for which I am getting error:
Resource:
execute 'generate ssl cert for simple https file server' do
cwd '/root/git/chef-bluecloud/bin/'
command <<-EOH
openssl req -new -days 365 -nodes -x509 \
-subj "/C=US/ST=NY/L=Somers/O=IBM/CN=bluecloud.xyz.com" \
-keyout localhost.pem \
-out localhost.pem
EOH
not_if 'test -f localhost.pem' # TODO: use ruby code instead of bash ::File.exists(...)
end
Spec:
it 'checks ssl cert generation for simple https file server' do
expect(chef_run).to run_execute('openssl req -new -days 365 -nodes -x509 \
-subj "/C=US/ST=NY/L=Somers/O=IBM/CN=bluecloud.xyz.com" \
-keyout localhost.pem \
-out localhost.pem \
').with(cwd:'/root/git/chef-bluecloud/bin/')
expect(chef_run).to_not run_execute('openssl null').with(cwd:'/root/git/chef-bluecloud/bin/')
end
Any ideas on how to resolve it ? Thanks !