- From: Mike <
>
- To: "
" <
>
- Subject: [chef] Re: Re: Chefspec link-matcher problem
- Date: Tue, 16 Jul 2013 16:05:50 -0400
Ranjib: that looks a lot more complicated than most asserts should be.
This commit [1] added support for link resources. Here's some syntax
examples and assertions:
https://github.com/acrmp/chefspec/blob/master/spec/chefspec/matchers/link_spec.rb#L7-L16
[1]:
https://github.com/jamesdburgess/chefspec/commit/350936575c3d9bd89385408c3786277f026122f2
-M
On Tue, Jul 16, 2013 at 3:55 PM, Ranjib Dey
<
>
wrote:
>
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
>
<
>
>
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.