module-nginx/spec/classes/service_spec.rb
Matthew Haughton 1898182c6d spec: cleanup
* Removed some tests that no longer apply and/or are redundant
* Only set OS facts when testing OS-specific behaviors. This simplifies the
  facts that must be set in the specs and saves running the same tests
  several times when the results wouldn't differ by OS anyway.
2014-12-09 19:47:05 -05:00

41 lines
1.2 KiB
Ruby

require 'spec_helper'
describe 'nginx::service' do
let :params do {
:configtest_enable => false,
:service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart',
:service_ensure => 'running',
} end
context "using default parameters" do
it { is_expected.to contain_service('nginx').with(
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true
)}
it { is_expected.to contain_service('nginx').without_restart }
end
describe "when configtest_enable => true" do
let :params do {
:configtest_enable => true,
:service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart',
:service_ensure => 'running',
} end
it { is_expected.to contain_service('nginx').with_restart('/etc/init.d/nginx configtest && /etc/init.d/nginx restart') }
context "when service_restart => 'a restart command'" do
let :params do {
:configtest_enable => true,
:service_restart => 'a restart command',
:service_ensure => 'running',
} end
it { is_expected.to contain_service('nginx').with_restart('a restart command') }
end
end
end