aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJorie Tappa <jorie@jorietappa.com>2018-08-01 11:27:33 -0500
committerJorie Tappa <jorie@jorietappa.com>2018-08-01 11:27:33 -0500
commit96d65f6d51da6b4798c81a717fb1a0d68c4c90e1 (patch)
treeba8045d45bd4919faebcd1a3442fac8e0d78cba6 /spec
parent2164cbe478d0d95568832c9de45a66b3ead21301 (diff)
downloadpuppet-cron_core-96d65f6d51da6b4798c81a717fb1a0d68c4c90e1.tar.gz
puppet-cron_core-96d65f6d51da6b4798c81a717fb1a0d68c4c90e1.tar.bz2
Fix RSpec/RepeatedExample violations
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/integration/provider/cron/crontab/crontab_user317
-rw-r--r--spec/integration/provider/cron/crontab_spec.rb6
-rw-r--r--spec/unit/provider/cron/parsed_spec.rb10
-rw-r--r--spec/unit/type/cron_spec.rb2
4 files changed, 22 insertions, 13 deletions
diff --git a/spec/fixtures/integration/provider/cron/crontab/crontab_user3 b/spec/fixtures/integration/provider/cron/crontab/crontab_user3
new file mode 100644
index 0000000..ae314ae
--- /dev/null
+++ b/spec/fixtures/integration/provider/cron/crontab/crontab_user3
@@ -0,0 +1,17 @@
+# HEADER: some simple
+# HEADER: header
+@daily /bin/unnamed_special_command >> /dev/null 2>&1
+
+# commend with blankline above and below
+
+17-19,22 0-23/2 * * 2 /bin/unnamed_regular_command
+
+# Puppet Name: My daily failure
+MAILTO=""
+@daily /bin/false
+# Puppet Name: Monthly job
+SHELL=/bin/sh
+MAILTO=mail@company.com
+15 14 1 * * $HOME/bin/monthly
+# Puppet Name: My weekly failure
+@weekly /bin/false
diff --git a/spec/integration/provider/cron/crontab_spec.rb b/spec/integration/provider/cron/crontab_spec.rb
index 0148d0c..c9661e4 100644
--- a/spec/integration/provider/cron/crontab_spec.rb
+++ b/spec/integration/provider/cron/crontab_spec.rb
@@ -136,13 +136,13 @@ describe Puppet::Type.type(:cron).provider(:crontab), '(integration)', unless: P
it "works correctly when managing 'target' but not 'user'" do
apply_with_error_check(<<-MANIFEST)
cron {
- 'My daily failure':
- special => 'daily',
+ 'My weekly failure':
+ special => 'weekly',
command => '/bin/false',
target => '#{crontab_user1}',
}
MANIFEST
- expect_output('crontab_user1')
+ expect_output('crontab_user3')
end
it 'does nothing if a matching entry already present' do
diff --git a/spec/unit/provider/cron/parsed_spec.rb b/spec/unit/provider/cron/parsed_spec.rb
index 8d6e282..d4460f7 100644
--- a/spec/unit/provider/cron/parsed_spec.rb
+++ b/spec/unit/provider/cron/parsed_spec.rb
@@ -194,18 +194,10 @@ describe Puppet::Type.type(:cron).provider(:crontab) do
Facter.stubs(:value).with(:operatingsystem)
end
- it 'contains no resources for a user who has no crontab' do
+ it 'contains no resources for a user who has no crontab, or for a user that is absent' do
# `crontab...` does only capture stdout here. On vixie-cron-4.1
# STDERR shows "no crontab for foobar" but stderr is ignored as
# well as the exitcode.
- described_class.target_object('foobar').expects(:`).with('crontab -u foobar -l 2>/dev/null').returns ''
- expect(described_class.instances.select do |resource|
- resource.get('target') == 'foobar'
- end).to be_empty
- end
-
- it 'contains no resources for a user who is absent' do
- # `crontab...` does only capture stdout. On vixie-cron-4.1
# STDERR shows "crontab: user `foobar' unknown" but stderr is
# ignored as well as the exitcode
described_class.target_object('foobar').expects(:`).with('crontab -u foobar -l 2>/dev/null').returns ''
diff --git a/spec/unit/type/cron_spec.rb b/spec/unit/type/cron_spec.rb
index e80ccb9..f60468a 100644
--- a/spec/unit/type/cron_spec.rb
+++ b/spec/unit/type/cron_spec.rb
@@ -46,7 +46,7 @@ describe Puppet::Type.type(:cron), unless: Puppet.features.microsoft_windows? do
end
it 'supports absent as a value for ensure' do
- expect { described_class.new(name: 'foo', ensure: :present) }.not_to raise_error
+ expect { described_class.new(name: 'foo', ensure: :absent) }.not_to raise_error
end
it 'does not support other values' do