default_spec.rb 2 KB
Newer Older
1 2
require 'spec_helper'

Tim Smith's avatar
Tim Smith committed
3
describe 'test::default' do
Lance Albertson's avatar
Lance Albertson committed
4
  cached(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '20.04').converge('test::default') }
Chase Bolt's avatar
Chase Bolt committed
5 6 7 8

  it 'enables and starts service[cron]' do
    expect(chef_run).to enable_service('cron')
    expect(chef_run).to start_service('cron')
9 10
  end

Lance Albertson's avatar
Lance Albertson committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
  #  it 'creates cron_d[bizarrely-scheduled-usage-report]' do
  #    expect(chef_run).to create_cron_d('bizarrely-scheduled-usage-report').with(
  #      minute: '*/5',
  #      hour: '1,23',
  #      day: '2-5',
  #      command: '/srv/app/scripts/generate_report',
  #      user: 'appuser'
  #    )
  #  end
  #
  #  it 'creates cron_d[test-month-usage-report]' do
  #    expect(chef_run).to create_cron_d('test-month-usage-report').with(
  #      minute: '0',
  #      hour: '6',
  #      month: '1',
  #      command: '/srv/app/scripts/generate_report',
  #      user: 'appuser'
  #    )
  #  end
  #
  #  it 'creates cron_d[fixnum-job]' do
  #    expect(chef_run).to create_cron_d('fixnum-job').with(
  #      minute: 0,
  #      hour: 1,
  #      day: 2,
  #      command: '/bin/true',
  #      user: 'appuser'
  #    )
  #  end
  #
  #  it 'creates cron_d[predefined_value_check]' do
  #    expect(chef_run).to create_cron_d('predefined_value_check').with(
  #      predefined_value: '@midnight',
  #      command: '/bin/true',
  #      user: 'appuser'
  #    )
  #  end
  #
  #  it 'creates cron_d[nil_value_check]' do
  #    expect(chef_run).to create_cron_d('nil_value_check').with(
  #      predefined_value: nil,
  #      command: '/bin/true',
  #      user: 'appuser'
  #    )
  #  end
  #
  #  it 'creates if missing cron_d[no_value_check]' do
  #    expect(chef_run).to create_if_missing_cron_d('no_value_check').with(
  #      command: '/bin/true',
  #      user: 'appuser'
  #    )
  #  end
Chase Bolt's avatar
Chase Bolt committed
63

Chase Bolt's avatar
Chase Bolt committed
64 65 66 67
  it 'creates file[/etc/cron.d/delete_cron]' do
    expect(chef_run).to create_file('/etc/cron.d/delete_cron')
  end

Lance Albertson's avatar
Lance Albertson committed
68 69 70
  #  it 'deletes cron_d[delete_cron]' do
  #    expect(chef_run).to delete_cron_d('delete_cron')
  #  end
71
end