aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGabriel Nagy <gabriel.nagy@puppet.com>2021-10-01 14:57:09 +0300
committerGabriel Nagy <gabriel.nagy@puppet.com>2021-10-01 14:57:09 +0300
commitdd42efd5323314047d2c44e02f2f7e3472954697 (patch)
treeaf6c3b59e878235d5e3736276e8fd22171465455 /spec
parent54db10d91bb5da04f8f4fb9d66138aba9e5e38a4 (diff)
downloadpuppet-cron_core-dd42efd5323314047d2c44e02f2f7e3472954697.tar.gz
puppet-cron_core-dd42efd5323314047d2c44e02f2f7e3472954697.tar.bz2
(MODULES-11197) Update to pdk-templates 2.2.0
Includes REFERENCE.md ToC fixes for MODULES-8183.
Diffstat (limited to 'spec')
-rw-r--r--spec/acceptance/tests/resource/cron/should_fail_to_write_a_nonexistent_users_crontab_spec.rb2
-rw-r--r--spec/acceptance/tests/resource/cron/should_not_overwrite_crontab_file_on_file_read_error_spec.rb2
-rw-r--r--spec/acceptance/tests/resource/cron/should_only_fail_associated_resources_on_file_read_error_spec.rb2
-rw-r--r--spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb2
-rw-r--r--spec/acceptance/tests/resource/cron/should_write_new_users_crontab_after_puppet_creates_them_spec.rb2
-rw-r--r--spec/unit/provider/cron/crontab_spec.rb4
-rw-r--r--spec/unit/provider/cron/parsed_spec.rb8
-rw-r--r--spec/unit/type/cron_spec.rb12
8 files changed, 17 insertions, 17 deletions
diff --git a/spec/acceptance/tests/resource/cron/should_fail_to_write_a_nonexistent_users_crontab_spec.rb b/spec/acceptance/tests/resource/cron/should_fail_to_write_a_nonexistent_users_crontab_spec.rb
index 40fbbd9..167260a 100644
--- a/spec/acceptance/tests/resource/cron/should_fail_to_write_a_nonexistent_users_crontab_spec.rb
+++ b/spec/acceptance/tests/resource/cron/should_fail_to_write_a_nonexistent_users_crontab_spec.rb
@@ -12,7 +12,7 @@ RSpec.context 'when Puppet attempts to write the crontab of a nonexistent user'
end
compatible_agents.each do |agent|
- it "should fail on #{agent}" do
+ it "fails on #{agent}" do
manifest = cron_manifest('second_entry', command: 'ls', user: nonexistent_username)
apply_manifest_on(agent, manifest, expect_failures: true)
end
diff --git a/spec/acceptance/tests/resource/cron/should_not_overwrite_crontab_file_on_file_read_error_spec.rb b/spec/acceptance/tests/resource/cron/should_not_overwrite_crontab_file_on_file_read_error_spec.rb
index 6a5b2c6..60c51c9 100644
--- a/spec/acceptance/tests/resource/cron/should_not_overwrite_crontab_file_on_file_read_error_spec.rb
+++ b/spec/acceptance/tests/resource/cron/should_not_overwrite_crontab_file_on_file_read_error_spec.rb
@@ -44,7 +44,7 @@ RSpec.context 'when Puppet cannot read a crontab file' do
end
compatible_agents.each do |agent|
- it "should not overwrite it on #{agent}" do
+ it "does not overwrite it on #{agent}" do
if older_agent?(agent)
skip('Skipping this test since we are on an older agent that does not have the PUP-9217 changes')
end
diff --git a/spec/acceptance/tests/resource/cron/should_only_fail_associated_resources_on_file_read_error_spec.rb b/spec/acceptance/tests/resource/cron/should_only_fail_associated_resources_on_file_read_error_spec.rb
index 1846523..e95dc29 100644
--- a/spec/acceptance/tests/resource/cron/should_only_fail_associated_resources_on_file_read_error_spec.rb
+++ b/spec/acceptance/tests/resource/cron/should_only_fail_associated_resources_on_file_read_error_spec.rb
@@ -42,7 +42,7 @@ RSpec.context 'when Puppet cannot read a crontab file' do
end
compatible_agents.each do |agent|
- it "should only fail the associated resources on #{agent}" do
+ it "onlies fail the associated resources on #{agent}" do
if older_agent?(agent)
skip('Skipping this test since we are on an older agent that does not have the PUP-9217 changes')
end
diff --git a/spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb b/spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb
index 834cac7..07d5375 100644
--- a/spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb
+++ b/spec/acceptance/tests/resource/cron/should_write_an_originally_unauthorized_users_crontab_if_puppet_authorizes_them_spec.rb
@@ -61,7 +61,7 @@ RSpec.context 'when Puppet authorizes a previously unauthorized user to use cron
compatible_agents.each do |agent|
is_aix_or_solaris_agent = agent['platform'].include?('aix') || agent['platform'].include?('solaris')
- it "should write that user's crontab on #{agent}", if: is_aix_or_solaris_agent do
+ it "writes that user's crontab on #{agent}", if: is_aix_or_solaris_agent do
step 'Add the unauthorized user to the cron.deny file' do
on(agent, "echo #{unauthorized_username} >> #{cron_deny_path[agent]}")
end
diff --git a/spec/acceptance/tests/resource/cron/should_write_new_users_crontab_after_puppet_creates_them_spec.rb b/spec/acceptance/tests/resource/cron/should_write_new_users_crontab_after_puppet_creates_them_spec.rb
index 12506ad..6fb7396 100644
--- a/spec/acceptance/tests/resource/cron/should_write_new_users_crontab_after_puppet_creates_them_spec.rb
+++ b/spec/acceptance/tests/resource/cron/should_write_new_users_crontab_after_puppet_creates_them_spec.rb
@@ -31,7 +31,7 @@ RSpec.context 'when Puppet creates a user in the middle of its run' do
end
compatible_agents.each do |agent|
- it "should be able to write their crontab on #{agent}" do
+ it "is able to write their crontab on #{agent}" do
puppet_result = nil
step "Create the new user, and the known + new user's crontab entries with Puppet" do
# Placing Cron[first_entry] before creating the new user
diff --git a/spec/unit/provider/cron/crontab_spec.rb b/spec/unit/provider/cron/crontab_spec.rb
index 6e28393..4047f82 100644
--- a/spec/unit/provider/cron/crontab_spec.rb
+++ b/spec/unit/provider/cron/crontab_spec.rb
@@ -37,11 +37,11 @@ describe Puppet::Type.type(:cron).provider(:crontab) do
samples = YAML.load(File.read(my_fixture('single_line.yaml'))) # rubocop:disable Security/YAMLLoad
samples.each do |name, data|
- it "should parse crontab line #{name} correctly" do
+ it "parses crontab line #{name} correctly" do
compare_crontab_record subject.parse_line(data[:text]), data[:record]
end
- it "should reconstruct the crontab line #{name} from the record" do
+ it "reconstructs the crontab line #{name} from the record" do
expect(subject.to_line(data[:record])).to eq(data[:text])
end
end
diff --git a/spec/unit/provider/cron/parsed_spec.rb b/spec/unit/provider/cron/parsed_spec.rb
index e4fa4cd..8e02ce6 100644
--- a/spec/unit/provider/cron/parsed_spec.rb
+++ b/spec/unit/provider/cron/parsed_spec.rb
@@ -81,7 +81,7 @@ describe Puppet::Type.type(:cron).provider(:crontab) do
# I'd use expect(ENV).to receive(:[]).with('USER') but this does not work because
# ENV["USER"] is evaluated at load time.
describe 'when determining the default target' do
- it "should use the current user #{ENV['USER']}", if: ENV['USER'] do
+ it "uses the current user #{ENV['USER']}", if: ENV['USER'] do
expect(described_class.default_target).to eq(ENV['USER'])
end
@@ -166,7 +166,7 @@ describe Puppet::Type.type(:cron).provider(:crontab) do
describe 'it should support special strings' do
['reboot', 'yearly', 'anually', 'monthly', 'weekly', 'daily', 'midnight', 'hourly'].each do |special|
- it "should support @#{special}" do
+ it "supports @#{special}" do
expect(described_class.parse_line("@#{special} /bin/true")).to eq(record_type: :crontab,
hour: :absent,
minute: :absent,
@@ -300,7 +300,7 @@ describe Puppet::Type.type(:cron).provider(:crontab) do
command: '/bin/false',
target: 'nobody',
}.each_pair do |field, new_value|
- it "should not match a record when #{field} does not match" do
+ it "does not match a record when #{field} does not match" do
record[field] = new_value
expect(described_class.match(record, resource[:name] => resource)).to be_falsey
end
@@ -317,7 +317,7 @@ describe Puppet::Type.type(:cron).provider(:crontab) do
command: '/bin/false',
target: 'root',
}.each_pair do |field, new_value|
- it "should not match a record when #{field} does not match" do
+ it "does not match a record when #{field} does not match" do
record_special[field] = new_value
expect(described_class.match(record_special, resource_special[:name] => resource_special)).to be_falsey
end
diff --git a/spec/unit/type/cron_spec.rb b/spec/unit/type/cron_spec.rb
index 78deabf..9564d16 100644
--- a/spec/unit/type/cron_spec.rb
+++ b/spec/unit/type/cron_spec.rb
@@ -21,19 +21,19 @@ describe Puppet::Type.type(:cron), unless: Puppet.features.microsoft_windows? do
describe 'when validating attributes' do
[:name, :provider].each do |param|
- it "should have a #{param} parameter" do
+ it "has a #{param} parameter" do
expect(described_class.attrtype(param)).to eq(:param)
end
end
[:command, :special, :minute, :hour, :weekday, :month, :monthday, :environment, :user, :target].each do |property|
- it "should have a #{property} property" do
+ it "has a #{property} property" do
expect(described_class.attrtype(property)).to eq(:property)
end
end
[:command, :minute, :hour, :weekday, :month, :monthday].each do |cronparam|
- it "should have #{cronparam} of type CronParam" do
+ it "has #{cronparam} of type CronParam" do
expect(described_class.attrclass(cronparam).ancestors).to include CronParam
end
end
@@ -490,7 +490,7 @@ describe Puppet::Type.type(:cron), unless: Puppet.features.microsoft_windows? do
describe 'special' do
['reboot', 'yearly', 'annually', 'monthly', 'weekly', 'daily', 'midnight', 'hourly'].each do |value|
- it "should support the value '#{value}'" do
+ it "supports the value '#{value}'" do
expect { described_class.new(name: 'foo', special: value) }.not_to raise_error
end
end
@@ -498,7 +498,7 @@ describe Puppet::Type.type(:cron), unless: Puppet.features.microsoft_windows? do
context 'when combined with numeric schedule fields' do
context "which are 'absent'" do
[['reboot', 'yearly', 'annually', 'monthly', 'weekly', 'daily', 'midnight', 'hourly'], :absent].flatten.each do |value|
- it "should accept the value '#{value}' for special" do
+ it "accepts the value '#{value}' for special" do
expect {
described_class.new(name: 'foo', minute: :absent, special: value)
}.not_to raise_error
@@ -507,7 +507,7 @@ describe Puppet::Type.type(:cron), unless: Puppet.features.microsoft_windows? do
end
context 'which are not absent' do
['reboot', 'yearly', 'annually', 'monthly', 'weekly', 'daily', 'midnight', 'hourly'].each do |value|
- it "should not accept the value '#{value}' for special" do
+ it "does not accept the value '#{value}' for special" do
expect {
described_class.new(name: 'foo', minute: '1', special: value)
}.to raise_error(Puppet::Error, %r{cannot specify both a special schedule and a value})