Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (21 sloc) 1.272 kb
Feature: Write examples for cookbook files
ChefSpec lets you express expectations about cookbook files created by your recipes.
Check that a cookbook file has been created:
chef_run.should create_file '/var/lib/foo'
Check that a file has the correct ownership:
chef_run.cookbook_file('/var/log/bar.log').should be_owned_by('user', 'group')
Scenario: Cookbook file resource
Given a Chef cookbook with a recipe that declares a cookbook file resource
And the recipe has a spec example that expects the cookbook file to be declared
When the recipe example is successfully run
Then the file will not have been created
Scenario: Cookbook file resource content
Given a Chef cookbook with a recipe that declares a cookbook file resource
And the recipe has a spec example of the cookbook file contents
When the recipe example is successfully run
Then the file will not have been created
Scenario: Check cookbook file ownership
Given a Chef cookbook with a recipe that sets cookbook file ownership
And the recipe has a spec example that expects the cookbook file to be set to be owned by a specific user
When the recipe example is successfully run
Then the file will not have had its ownership changed
Jump to Line
Something went wrong with that request. Please try again.