Module: ChefSpec::API::LinkMatchers
- Defined in:
- lib/chefspec/api/link.rb
Overview
Instance Method Summary collapse
-
#create_link(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
link
resource exists in the Chef run with the action:create
. -
#delete_link(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
link
resource exists in the Chef run with the action:delete
. -
#link_to(path) ⇒ ChefSpec::Matchers::LinkToMatcher
Assert that a symlink links to a specific path.
Instance Method Details
#create_link(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a link
resource exists in the Chef run with the action :create
. Given a Chef Recipe that creates “/tmp” as a link
:
link '/tmp' do
action :create
end
The Examples section demonstrates the different ways to test a link
resource with ChefSpec.
39 40 41 |
# File 'lib/chefspec/api/link.rb', line 39 def create_link(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:link, :create, resource_name) end |
#delete_link(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a link
resource exists in the Chef run with the action :delete
. Given a Chef Recipe that deletes “/tmp” as a link
:
link '/tmp' do
action :delete
end
The Examples section demonstrates the different ways to test a link
resource with ChefSpec.
76 77 78 |
# File 'lib/chefspec/api/link.rb', line 76 def delete_link(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:link, :delete, resource_name) end |
#link_to(path) ⇒ ChefSpec::Matchers::LinkToMatcher
Assert that a symlink links to a specific path. This is really syntactic sugar for the following:
expect(chef_run).to create_link('/tmp/thing').with(to: '/tmp/other_thing')
98 99 100 |
# File 'lib/chefspec/api/link.rb', line 98 def link_to(path) ChefSpec::Matchers::LinkToMatcher.new(path) end |