Skip to content

Instantly share code, notes, and snippets.

@atrull
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atrull/11223163 to your computer and use it in GitHub Desktop.
Save atrull/11223163 to your computer and use it in GitHub Desktop.
goodcooking:myface alextrull$ rspec .
myface::default
should create a service account for the myface daemon (FAILED - 1)
should install the sudo package (FAILED - 2)
Failures:
1) myface::default should create a service account for the myface daemon
Failure/Error: let (:chef_run) { ChefSpec::ChefRunner.new.converge 'myface::default' }
NameError:
uninitialized constant ChefSpec::ChefRunner
# ./spec/default_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/default_spec.rb:8:in `block (2 levels) in <top (required)>'
2) myface::default should install the sudo package
Failure/Error: let (:chef_run) { ChefSpec::ChefRunner.new.converge 'myface::default' }
NameError:
uninitialized constant ChefSpec::ChefRunner
# ./spec/default_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/default_spec.rb:13:in `block (2 levels) in <top (required)>'
Finished in 0.00047 seconds
2 examples, 2 failures
Failed examples:
rspec ./spec/default_spec.rb:7 # myface::default should create a service account for the myface daemon
rspec ./spec/default_spec.rb:12 # myface::default should install the sudo package
goodcooking:myface alextrull$ cat recipes/default.rb
#
# Cookbook Name:: myface
# Recipe:: default
#
# Copyright (C) 2014 YOUR_NAME
#
# All rights reserved - Do Not Redistribute
#
user "myface"
package "sudo"
goodcooking:myface alextrull$ cat spec/default_spec.rb
require 'chefspec'
describe 'myface::default' do
let (:chef_run) { ChefSpec::ChefRunner.new.converge 'myface::default' }
# Check to make sure the user is created
it 'should create a service account for the myface daemon' do
expect(chef_run).to create_user 'myface'
end
# Install the sudo package
it 'should install the sudo package' do
expect(chef_run).to install_package('sudo')
end
end
-- Looks legit to me, what could be wrong ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment