[chef] Mocking out a class in Chefspec


Chronological Thread 
  • From: < >
  • To:
  • Subject: [chef] Mocking out a class in Chefspec
  • Date: Wed, 12 Nov 2014 14:03:13 -0800 (PST)

Hi, we're trying to mock out citadel in chefspec but aren't getting anywhere.
Here's what we have so in our spec file:

before do
    require File.join(RSpec.configuration.cookbook_path, '/',
'citadel/libraries/default.rb')
    allow_any_instance_of(Citadel).to
receive(:[]).with('development/celery__result_db_username').and_return('fakeusername')
    allow_any_instance_of(Citadel).to
receive(:[]).with('development/celery__result_db_password').and_return('fakepassword')
  end

This seems to import citadel, but then the mocks are never called.

FYI here's a link to citadel repo https://github.com/poise/citadel

Thanks!
Alex



Archive powered by MHonArc 2.6.16.

§