Module: ChefSpec::API::ServiceMatchers
- Defined in:
- lib/chefspec/api/service.rb
Overview
Instance Method Summary collapse
-
#disable_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
serviceresource exists in the Chef run with the action:disable. -
#enable_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
serviceresource exists in the Chef run with the action:enable. -
#reload_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
serviceresource exists in the Chef run with the action:reload. -
#restart_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
serviceresource exists in the Chef run with the action:restart. -
#start_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
serviceresource exists in the Chef run with the action:start. -
#stop_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a
serviceresource exists in the Chef run with the action:stop.
Instance Method Details
#disable_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a service resource exists in the Chef run with the action :disable. Given a Chef Recipe that disables “apache2” as a service:
service 'apache2' do
action :disable
end
To test the content rendered by a service, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a service resource with ChefSpec.
42 43 44 |
# File 'lib/chefspec/api/service.rb', line 42 def disable_service(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:service, :disable, resource_name) end |
#enable_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a service resource exists in the Chef run with the action :enable. Given a Chef Recipe that enables “apache2” as a service:
service 'apache2' do
action :enable
end
To test the content rendered by a service, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a service resource with ChefSpec.
82 83 84 |
# File 'lib/chefspec/api/service.rb', line 82 def enable_service(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:service, :enable, resource_name) end |
#reload_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a service resource exists in the Chef run with the action :reload. Given a Chef Recipe that reloads “apache2” as a service:
service 'apache2' do
action :reload
end
To test the content rendered by a service, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a service resource with ChefSpec.
122 123 124 |
# File 'lib/chefspec/api/service.rb', line 122 def reload_service(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:service, :reload, resource_name) end |
#restart_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a service resource exists in the Chef run with the action :restart. Given a Chef Recipe that restarts “apache2” as a service:
service 'apache2' do
action :restart
end
To test the content rendered by a service, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a service resource with ChefSpec.
162 163 164 |
# File 'lib/chefspec/api/service.rb', line 162 def restart_service(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:service, :restart, resource_name) end |
#start_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a service resource exists in the Chef run with the action :start. Given a Chef Recipe that starts “apache2” as a service:
service 'apache2' do
action :start
end
To test the content rendered by a service, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a service resource with ChefSpec.
202 203 204 |
# File 'lib/chefspec/api/service.rb', line 202 def start_service(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:service, :start, resource_name) end |
#stop_service(resource_name) ⇒ ChefSpec::Matchers::ResourceMatcher
Assert that a service resource exists in the Chef run with the action :stop. Given a Chef Recipe that stops “apache2” as a service:
service 'apache2' do
action :stop
end
To test the content rendered by a service, see RenderFileMatchers.
The Examples section demonstrates the different ways to test a service resource with ChefSpec.
242 243 244 |
# File 'lib/chefspec/api/service.rb', line 242 def stop_service(resource_name) ChefSpec::Matchers::ResourceMatcher.new(:service, :stop, resource_name) end |