[chef] Re: Re: Re: Chefspec question


Chronological Thread 
  • From: Ranjib Dey < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Chefspec question
  • Date: Wed, 7 Jan 2015 22:14:05 -0800

diff of rendered template with what? like chef we dont have an existing file to generate the diff against.
chef core already has pretty neat helper methods for this :-) 


On Wed, Jan 7, 2015 at 9:24 PM, Bill Warner < " target="_blank"> > wrote:
Hi Dey,

Cool, I was just looking for some validation.  All the examples always seem to have a small snip it of content or maybe a regex.  I wasn't sure if putting a fully rendered template was going to cause me some unforseen problems latter.

Would be nice if the failed test could output a diff :)

-Bill

On Wed, Jan 7, 2015 at 9:31 PM, Ranjib Dey < " target="_blank"> > wrote:
hi bill,
I use it a lot to test our cookbooks. its particularly helpful if you use partials , etc. I know at least couple of other groups that are using it.

Note: i co-maintain chefspec with seth, so i am biased :0-)

ranjib

On Wed, Jan 7, 2015 at 7:57 PM, Bill Warner < " target="_blank"> > wrote:
I've only been using chefspec for about a month now and was wondering, Is this a good idea?

it 'renders the file with content from ./spec/rendered_templates/template.conf' do
template_conf = File.read('./spec/rendered_templates/template.conf')
expect(chef_run).to render_file('/etc/template.conf').with_content(template_conf)
end

With a known default rendered template in rendered_templates of course.  It was what I though render_file would expect but I never saw it as an example anywhere.  It works as I expected so I'm using it.  Just not seeing it elsewhere makes me think there's something I'm missing.

Thanks,
--
--
Bill Warner




--
--
Bill Warner




Archive powered by MHonArc 2.6.16.

§