aboutsummaryrefslogtreecommitdiff
path: root/spec/integration/provider/cron/crontab_spec.rb
diff options
context:
space:
mode:
authorGabriel Nagy <gabriel.nagy@puppet.com>2021-03-11 14:17:09 +0200
committerGabriel Nagy <gabriel.nagy@puppet.com>2021-03-11 14:37:19 +0200
commit51ebf2d8d5c02c7cd314edd9e6507163a8073785 (patch)
tree5d48c36b51fcf8116d4a4160a764f09e4abeb92c /spec/integration/provider/cron/crontab_spec.rb
parent7c3c42cecb1b864d026404c551374b1d95ee7d95 (diff)
downloadpuppet-cron_core-51ebf2d8d5c02c7cd314edd9e6507163a8073785.tar.gz
puppet-cron_core-51ebf2d8d5c02c7cd314edd9e6507163a8073785.tar.bz2
(maint) Switch to rspec-mocks
Diffstat (limited to 'spec/integration/provider/cron/crontab_spec.rb')
-rw-r--r--spec/integration/provider/cron/crontab_spec.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/integration/provider/cron/crontab_spec.rb b/spec/integration/provider/cron/crontab_spec.rb
index 989eae6..a419774 100644
--- a/spec/integration/provider/cron/crontab_spec.rb
+++ b/spec/integration/provider/cron/crontab_spec.rb
@@ -7,17 +7,17 @@ describe Puppet::Type.type(:cron).provider(:crontab), unless: Puppet.features.mi
include PuppetSpec::Compiler
before :each do
- Puppet::Type.type(:cron).stubs(:defaultprovider).returns described_class
- described_class.stubs(:suitable?).returns true
- Puppet::FileBucket::Dipper.any_instance.stubs(:backup) # rubocop:disable RSpec/AnyInstance
+ allow(Puppet::Type.type(:cron)).to receive(:defaultprovider).and_return described_class
+ allow(described_class).to receive(:suitable?).and_return true
+ allow_any_instance_of(Puppet::FileBucket::Dipper).to receive(:backup) # rubocop:disable RSpec/AnyInstance
# I don't want to execute anything
- described_class.stubs(:filetype).returns Puppet::Util::FileType::FileTypeFlat
- described_class.stubs(:default_target).returns crontab_user1
+ allow(described_class).to receive(:filetype).and_return Puppet::Util::FileType::FileTypeFlat
+ allow(described_class).to receive(:default_target).and_return crontab_user1
# I don't want to stub Time.now to get a static header because I don't know
# where Time.now is used elsewhere, so just go with a very simple header
- described_class.stubs(:header).returns "# HEADER: some simple\n# HEADER: header\n"
+ allow(described_class).to receive(:header).and_return "# HEADER: some simple\n# HEADER: header\n"
FileUtils.cp(my_fixture('crontab_user1'), crontab_user1)
FileUtils.cp(my_fixture('crontab_user2'), crontab_user2)
end
@@ -113,9 +113,9 @@ describe Puppet::Type.type(:cron).provider(:crontab), unless: Puppet.features.mi
MANIFEST
apply_compiled_manifest(manifest) do |res|
if res.ref == 'Cron[Entirely new resource]'
- res.expects(:err).with(regexp_matches(%r{no command}))
+ expect(res).to receive(:err).with(%r{no command})
else
- res.expects(:err).never
+ expect(res).not_to receive(:err)
end
end
end