module-nginx/spec/classes/service_spec.rb
Matthew Haughton 32bc360d45 Convert specs to RSpec 2.99.1 syntax with Transpec
This conversion is done by Transpec 2.3.4 with the following command:
    transpec -c "rake spec" spec/classes/ spec/defines/ spec/spec_helper.rb

* 210 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 19 conversions
    from: it { should_not ... }
      to: it { is_expected.not_to ... }

* 15 conversions
    from: == expected
      to: eq(expected)

* 15 conversions
    from: obj.should
      to: expect(obj).to

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2014-07-17 22:28:38 -04:00

38 lines
1.2 KiB
Ruby

require 'spec_helper'
describe 'nginx::service' do
let :facts do {
:osfamily => 'Debian',
:operatingsystem => 'debian',
} end
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) {{ :configtest_enable => true, :service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart'}}
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) {{ :configtest_enable => true, :service_restart => 'a restart command' }}
it { is_expected.to contain_service('nginx').with_restart('a restart command') }
end
end
end