Module: ChefSpec::API::FileMatchers
- Defined in:
- lib/chefspec/api/file.rb
Overview
Instance Method Summary collapse
-
#create_file(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
file
resource exists in the Chef run with the action:create
. -
#create_file_if_missing(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
file
resource exists in the Chef run with the action:create_if_missing
. -
#delete_file(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
file
resource exists in the Chef run with the action:delete
. -
#touch_file(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
file
resource exists in the Chef run with the action:touch
.
Instance Method Details
#create_file(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a file
resource exists in the Chef run with the action :create
. Given a Chef Recipe that creates “/tmp/config” as a file
:
file '/tmp/config' do
action :create
end
To test the content rendered by a file
, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a file
resource with ChefSpec.
42 43 44 |
# File 'lib/chefspec/api/file.rb', line 42 def create_file(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:file, :create, resource_name) end |
#create_file_if_missing(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a file
resource exists in the Chef run with the action :create_if_missing
. Given a Chef Recipe that creates “/tmp/config” if missing as a file
:
file '/tmp/config' do
action :create_if_missing
end
To test the content rendered by a file
, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a file
resource with ChefSpec.
82 83 84 |
# File 'lib/chefspec/api/file.rb', line 82 def create_file_if_missing(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:file, :create_if_missing, resource_name) end |
#delete_file(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a file
resource exists in the Chef run with the action :delete
. Given a Chef Recipe that deletes “/tmp/config” as a file
:
file '/tmp/config' do
action :delete
end
To test the content rendered by a file
, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a file
resource with ChefSpec.
122 123 124 |
# File 'lib/chefspec/api/file.rb', line 122 def delete_file(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:file, :delete, resource_name) end |
#touch_file(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a file
resource exists in the Chef run with the action :touch
. Given a Chef Recipe that touches “/tmp/config” as a file
:
file '/tmp/config' do
action :touch
end
To test the content rendered by a file
, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a file
resource with ChefSpec.
162 163 164 |
# File 'lib/chefspec/api/file.rb', line 162 def touch_file(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:file, :touch, resource_name) end |