[chef] Re: Re: chefspec and lazy


Chronological Thread 
  • From: Joe Nuspl < >
  • To:
  • Subject: [chef] Re: Re: chefspec and lazy
  • Date: Tue, 21 Oct 2014 15:48:33 -0700

I am able to reproduce the issue with the following snippet:

execute 'cmd' do
  command lazy { node['cmd'] }
end

node.default['cmd'] = '/bin/true'

The corresponding spec is:

describe ‘test::lazy' do
  subject do
    ChefSpec::Runner.new.converge(described_recipe)
  end

  it { should run_execute('cmd') }
end



On Oct 21, 2014, at 3:10 PM, Peter Burkholder < "> > wrote:

Can you share a bit more of the code you have under test?

On Tue, Oct 21, 2014 at 5:34 PM, Joe Nuspl < " target="_blank"> > wrote:
I’m trying to write a unit test for a recipe that uses http://docs.getchef.com/resource_common.html#lazy-attribute-evaluation

It fails with:

Failure/Error: runner.converge(described_recipe)
NoMethodError:
 undefined method `lazy' for Chef::Resource::Execute

Any ideas on how to make this work?

Joe





Archive powered by MHonArc 2.6.16.

§