[chef] chefspec and stub_search macro


Chronological Thread 
  • From: Holger Amann < >
  • To: " " < >
  • Subject: [chef] chefspec and stub_search macro
  • Date: Wed, 16 Oct 2013 13:45:35 +0200

Hi,

maybe I am doing it wrong, but stubbing with stub_search(:apps) raises 
Chef::Exceptions::PrivateKeyMissing!?

describe "#load_configurations" do
    it 'should return app configuration' do

      env = Chef::Environment.new
      env.name 'production'
      runner.node.stub(:chef_environment).and_return env.name
      Chef::Environment.stub(:load).and_return env

      #  stub_search(:apps) { JSON.parse(File.read('fixutres/sauspiel.json')) 
}

      chef_run
      
      stub_search(:apps) { JSON.parse(File.read('fixutres/sauspiel.json')) }

      w = NS::GameserverFrontend.new(runner.node, 'tcp', 'production')

      w.load_configuration('sauspiel')
      expect(w.app_configurations["sauspiel"]).to eq({"test" => "1"})
    end
  end


Any ideas?

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail




Archive powered by MHonArc 2.6.16.

§