Skip to content

Commit

Permalink
Add the new spec files for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
karcaw committed Apr 25, 2017
1 parent 771d2d8 commit d814579
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
1 change: 0 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
#
automatic_updates 'default' do
action :enable
send_email 'no'
end
16 changes: 14 additions & 2 deletions spec/unit/recipes/automatic_updates_centos68_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
step_into: ['automatic_updates'],
}.freeze

context 'Enable automationc_update' do
context 'Enable automatic_update' do
let(:chef_run) do
ChefSpec::SoloRunner.new(CENTOS68_OPTS) do |node|
node_resources(node)
Expand Down Expand Up @@ -42,7 +42,19 @@
end
end

context 'Disable automationc_update' do
context 'Enable automatic_update without email' do
let(:chef_run) do
ChefSpec::SoloRunner.new(CENTOS68_OPTS) do |node|
node_resources(node)
end.converge('automatic_updates_test::enable_noemail')
end

it 'enables automatic updates in yum-cron.conf' do
expect(chef_run).to render_file('/etc/yum/yum-cron.conf').with_content('update_messages = no')
end
end

context 'Disable automatic_update' do
let(:chef_run) do
ChefSpec::SoloRunner.new(CENTOS68_OPTS) do |node|
node_resources(node)
Expand Down
16 changes: 14 additions & 2 deletions spec/unit/recipes/automatic_updates_centos72_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
step_into: ['automatic_updates'],
}.freeze

context 'Enable automationc_update' do
context 'Enable automatic_update' do
let(:chef_run) do
ChefSpec::SoloRunner.new(CENTOS72_OPTS) do |node|
node_resources(node)
Expand Down Expand Up @@ -42,7 +42,19 @@
end
end

context 'Disable automationc_update' do
context 'Enable automatic_update without email' do
let(:chef_run) do
ChefSpec::SoloRunner.new(CENTOS72_OPTS) do |node|
node_resources(node)
end.converge('automatic_updates_test::enable_noemail')
end

it 'enables automatic updates in yum-cron.conf' do
expect(chef_run).to render_file('/etc/yum/yum-cron.conf').with_content('update_messages = no')
end
end

context 'Disable automatic_update' do
let(:chef_run) do
ChefSpec::SoloRunner.new(CENTOS72_OPTS) do |node|
node_resources(node)
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/recipes/automatic_updates_ubuntu1404_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
step_into: ['automatic_updates'],
}.freeze

context 'Enable automationc_update' do
context 'Enable automatic_update' do
let(:chef_run) do
ChefSpec::SoloRunner.new(UBUNTU1404_OPTS) do |node|
node_resources(node)
Expand All @@ -22,7 +22,7 @@
it_behaves_like 'enable automatic updates for Ubuntu'
end

context 'Disable automationc_update' do
context 'Disable automatic_update' do
let(:chef_run) do
ChefSpec::SoloRunner.new(UBUNTU1404_OPTS) do |node|
node_resources(node)
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/recipes/automatic_updates_ubuntu1604_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
step_into: ['automatic_updates'],
}.freeze

context 'Enable automationc_update' do
context 'Enable automatic_update' do
let(:chef_run) do
ChefSpec::SoloRunner.new(UBUNTU1604_OPTS) do |node|
node_resources(node)
Expand All @@ -22,7 +22,7 @@
it_behaves_like 'enable automatic updates for Ubuntu'
end

context 'Disable automationc_update' do
context 'Disable automatic_update' do
let(:chef_run) do
ChefSpec::SoloRunner.new(UBUNTU1604_OPTS) do |node|
node_resources(node)
Expand Down
1 change: 0 additions & 1 deletion test/integration/default/inspec/yum_cron_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
describe file('/etc/yum/yum-cron.conf') do
its(:content) { should match(/download_updates = yes/) }
its(:content) { should match(/apply_updates = yes/) }
its(:content) { should match(/update_messages = no/) }
end

describe service('yum-cron') do
Expand Down

0 comments on commit d814579

Please sign in to comment.