[chef] Re: chefspec and stub_search macro


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

Seems like it has something to do with upgrade to chefspec 3, because every 
stub on search raises the same exception now, even with 
Chef::Search::Query.any_instance.stub(:search) :/
It's working again if I downgrade to 2.0.1


Am 16.10.2013 um 13:45 schrieb Holger Amann 
< >:

> 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.

§