aboutsummaryrefslogtreecommitdiff
path: root/spec/acceptance/tests/resource/cron/should_fail_to_write_a_nonexistent_users_crontab_spec.rb
blob: 40fbbd9453c97e0985c1d1af6d31e8b4fa383a5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'spec_helper_acceptance'

RSpec.context 'when Puppet attempts to write the crontab of a nonexistent user' do
  let(:nonexistent_username) { "pl#{rand(999_999).to_i}" }

  before(:each) do
    step 'Ensure that the nonexistent user does not exist' do
      compatible_agents.each do |agent|
        user_absent(agent, nonexistent_username)
      end
    end
  end

  compatible_agents.each do |agent|
    it "should fail on #{agent}" do
      manifest = cron_manifest('second_entry', command: 'ls', user: nonexistent_username)
      apply_manifest_on(agent, manifest, expect_failures: true)
    end
  end
end