ChefDK is new enough that I’m not sure what the ‘ChefDK’ way is. But I’d use bundler and a Gemfile in your project, so that all your gems (rspec, etc) are using the same Gem versions.
I did find this bug:
That suggests you may be able to do ‘chef run rake’ or something like that and get the same rake+rspec you get from running rspec yourself. Or get the chef paths and hooks in front of your rake command by running – eval “$(chef shell-init bash)” – I haven’t tested that, though. It sounds like down the road they plan on wrapping all that with a ‘chef test’ command, too.
Hope this helps,
Martin B. Smith, email@example.com:firstname.lastname@example.org | 800-961-4454
5000 Walzem Rd. | San Antonio, TX 78218
Rackspace - the open cloud company
Ask about our DevOps Automation Service - www.rackspace.com/devopshttp://www.rackspace.com/devops/
From: Booker Bense [email@example.com]
Sent: Friday, August 15, 2014 11:39 AM
Subject: [chef] ChefDK and rake
I’m testing a cookbook I set up with mis using the ChefDK environment.
I have done chef shell-init and
which rspec returns
This command runs the chefspec tests.
chef exec rspec test/unit/spec
However this rake task fails with error suggesting it’s using the wrong rspec
desc 'Run ChefSpec unit tests’
RSpec::Core::RakeTask.new(:spec) do |t, _args|
t.rspec_opts = 'test/unit/spec’
Is there something obvious I’m missing to make this work?