<commit_before>require 'spec_helper'

describe 'cron::d' do
  let(:title) { 'foobar' }
  let(:facts) {{
    :operatingsystemrelease => '14.04',
    :osfamily => 'Debian'
    :lsbdistid => 'Ubuntu',
    :lsbdistrelease => '14.04',
  }}
  let(:pre_condition) { [(site_pp rescue ""), "class { 'cron': }"] }
  let(:params) {{
    :minute  => 37,
    :user    => 'somebody',
    :command => 'foobar | logger -t cleanup-srv-deploy -p daemon.info',
  }}

  it {
    should contain_exec('Symlink /nail/etc/cron.d/foobar at /etc/cron.d/foobar') \
      .with_command("ln -nsf '/nail/etc/cron.d/foobar' '/etc/cron.d/foobar'")
    should contain_file('/nail/etc/cron.d/foobar').with_ensure('file')

    should_not contain_cron__staleness_check
  }

  [
    /MAILTO=""/,
    /^37 \* \* \* \* somebody \(foobar/m
  ].each do |regex|
    it {
      should contain_file('/nail/etc/cron.d/foobar') \
        .with_content(regex)
    }
  end

  context 'with staleness' do
    let(:params) {{<commit_msg>Fix trailing comma on spec test<commit_after>require 'spec_helper'

describe 'cron::d' do
  let(:title) { 'foobar' }
  let(:facts) {{
    :operatingsystemrelease => '14.04',
    :osfamily => 'Debian',
    :lsbdistid => 'Ubuntu',
    :lsbdistrelease => '14.04',
  }}
  let(:pre_condition) { [(site_pp rescue ""), "class { 'cron': }"] }
  let(:params) {{
    :minute  => 37,
    :user    => 'somebody',
    :command => 'foobar | logger -t cleanup-srv-deploy -p daemon.info',
  }}

  it {
    should contain_exec('Symlink /nail/etc/cron.d/foobar at /etc/cron.d/foobar') \
      .with_command("ln -nsf '/nail/etc/cron.d/foobar' '/etc/cron.d/foobar'")
    should contain_file('/nail/etc/cron.d/foobar').with_ensure('file')

    should_not contain_cron__staleness_check
  }

  [
    /MAILTO=""/,
    /^37 \* \* \* \* somebody \(foobar/m
  ].each do |regex|
    it {
      should contain_file('/nail/etc/cron.d/foobar') \
        .with_content(regex)
    }
  end

  context 'with staleness' do
    let(:params) {{
{'fraction_non_alphanumeric': 0.1921726041144004, 'fraction_numerical': 0.012042147516307075, 'mean_word_length': 2.8199233716475094, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6575648', 'n_tokens_mistral': 827, 'n_tokens_neox': 763, 'n_words': 133}