[chef] Re: Chefspec link-matcher problem


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Chefspec link-matcher problem
  • Date: Tue, 16 Jul 2013 12:55:11 -0700

expect(chef_run.link('/tmp/tmp')).to_not be_nil

so you are checking that there a link resource present with name /tmp/tmp

to check the `to` attribute
expect(chef_run.link('/tmp/tmp').to).to eq('/foo/abr')





On Tue, Jul 16, 2013 at 12:34 PM, Arnold Krille < " target="_blank"> > wrote:
Hi,

after quite some changes to adopt the munin-cookbook to our needs, I am
coming back to checking my stuff with rspec/chefspec.

And especially I want to check that the recipe creates the links for
the munin-plugins as needed (depending on other factors like recipes on
the own node).

But I somehow fail to test that with chefspec. My very minimal
test-case is:

= recipe "munin::plugin_test":

link '/tmp/tmp' do
  to '/bin/bash'
  action 'create'
end

====

= spec-file:

describe 'munin::plugin_test' do
  it "should create a link for a plugin" do
    chef_run = ChefSpec::ChefRunner.new()

    chef_run.converge 'munin::plugin_test'

    chef_run.link '/tmp/tmp'
    chef_run.link '/completely fake'
  end
end

====

And altough the last test should be false, chefspec doesn't complain at
all. I also tried to write it as:
  chef_run.should link_to '/tmp/tmp'
but that gives errors that there is no method 'to' on 'link'...

I am using chefspec 1.3.1 and just updated all the local gems (inside
the used rbenv).

What am I doing wrong? Can anyone point me to a working example how to
check filesystem-links with chefspec?

Thanks in advance,

Arnold




Archive powered by MHonArc 2.6.16.

§