Checking that a dcirectory exists with ChefSpec/RSpec

Hi,

I’ve got a unit test that uses another recipe to install chocolatey. I want
to check that the folder that chocolatey is installed to exists. Given that
the recipe doesn’t create the folder, what is the best way of doing this
using ChefSpec?

Kind regards

Sean.

On Jun 22, 2015, at 11:28 AM, Sean Farrow seanfarrow1984@gmail.com wrote:

Hi,

I’ve got a unit test that uses another recipe to install chocolatey. I want to check that the folder that chocolatey is installed to exists. Given that the recipe doesn’t create the folder, what is the best way of doing this using ChefSpec?
Kind regards
Sean.

Assuming you use a directory resource to create it, expect(chef_run).to create_directory(‘c:\whatever’)

–Noah

Hi,

The package creates this when it installs, it doesn’t use chef!
Cheers
Sean.

-----Original Message-----
From: Noah Kantrowitz [mailto:noah@coderanger.net]
Sent: 22 June 2015 19:30
To: chef@lists.opscode.com
Subject: [chef] Re: Checking that a dcirectory exists with ChefSpec/RSpec

On Jun 22, 2015, at 11:28 AM, Sean Farrow seanfarrow1984@gmail.com wrote:

Hi,

I’ve got a unit test that uses another recipe to install chocolatey. I
want to check that the folder that chocolatey is installed to exists. Given
that the recipe doesn’t create the folder, what is the best way of doing
this using ChefSpec?
Kind regards
Sean.

Assuming you use a directory resource to create it, expect(chef_run).to
create_directory(‘c:\whatever’)

–Noah

On Jun 22, 2015, at 11:48 AM, Sean Farrow seanfarrow1984@gmail.com wrote:

Hi,

The package creates this when it installs, it doesn’t use chef!
Cheers
Sean.

Then you cannot test it with ChefSpec as ChefSpec doesn’t actually run the package install. Use Test-Kitchen and Serverspec for integration/functional testing.

–Noah