diff --git a/recipes/default.rb b/recipes/default.rb index 888b4b1..5d494ad 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -7,5 +7,4 @@ # automatic_updates 'default' do action :enable - send_email 'no' end diff --git a/spec/unit/recipes/automatic_updates_centos68_spec.rb b/spec/unit/recipes/automatic_updates_centos68_spec.rb index 016bcac..5d6806c 100644 --- a/spec/unit/recipes/automatic_updates_centos68_spec.rb +++ b/spec/unit/recipes/automatic_updates_centos68_spec.rb @@ -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) @@ -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) diff --git a/spec/unit/recipes/automatic_updates_centos72_spec.rb b/spec/unit/recipes/automatic_updates_centos72_spec.rb index b20ec2d..8a199e0 100644 --- a/spec/unit/recipes/automatic_updates_centos72_spec.rb +++ b/spec/unit/recipes/automatic_updates_centos72_spec.rb @@ -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) @@ -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) diff --git a/spec/unit/recipes/automatic_updates_ubuntu1404_spec.rb b/spec/unit/recipes/automatic_updates_ubuntu1404_spec.rb index 6a48267..075cdec 100644 --- a/spec/unit/recipes/automatic_updates_ubuntu1404_spec.rb +++ b/spec/unit/recipes/automatic_updates_ubuntu1404_spec.rb @@ -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) @@ -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) diff --git a/spec/unit/recipes/automatic_updates_ubuntu1604_spec.rb b/spec/unit/recipes/automatic_updates_ubuntu1604_spec.rb index 394faec..c31e979 100644 --- a/spec/unit/recipes/automatic_updates_ubuntu1604_spec.rb +++ b/spec/unit/recipes/automatic_updates_ubuntu1604_spec.rb @@ -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) @@ -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) diff --git a/test/fixtures/cookbooks/automatic_updates_test/recipes/enable_noemail.rb b/test/fixtures/cookbooks/automatic_updates_test/recipes/enable_noemail.rb new file mode 100644 index 0000000..6597922 --- /dev/null +++ b/test/fixtures/cookbooks/automatic_updates_test/recipes/enable_noemail.rb @@ -0,0 +1,7 @@ +# comments! +include_recipe 'disable_ipv6' + +automatic_updates 'default' do + action :enable + send_email 'no' +end diff --git a/test/integration/default/inspec/yum_cron_spec.rb b/test/integration/default/inspec/yum_cron_spec.rb index 56598a4..9f31d40 100644 --- a/test/integration/default/inspec/yum_cron_spec.rb +++ b/test/integration/default/inspec/yum_cron_spec.rb @@ -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