Basic tests not passing

413 views
Skip to first unread message

Testing with Chef

unread,
Apr 23, 2014, 5:43:00 PM4/23/14
to testing-...@googlegroups.com

Re: Alex Trull

I've got a two basic tests from the TDD training material that should be passing, but isn't.

https://gist.github.com/atrull/11223163

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"

-- Looks legit to me, what could be wrong ?

lipenkov

unread,
Apr 24, 2014, 7:56:39 AM4/24/14
to testing-...@googlegroups.com
Hello! 

Try use "ChefSpec::Runner" instead "ChefSpec::ChefRunner"

trekr5

unread,
Nov 21, 2014, 10:04:42 AM11/21/14
to testing-...@googlegroups.com, testing-...@googlegroups.com

Upgrade chefspec gem to 3.2.0 and use ChefSpec::Runner in your test.

I had the same problem and solved it this way.
Reply all
Reply to author
Forward
0 new messages