aboutsummaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
authorGheorghe Popescu <gheorghe.popescu@puppet.com>2021-03-12 09:13:22 +0200
committerGitHub <noreply@github.com>2021-03-12 09:13:22 +0200
commit45850cc69103259925d7f4f829b57b95dd173b89 (patch)
tree3caa87736d1f4c8b0d10e053d7f36e6eafb4b13c /spec/integration
parent771a514cbc792481d98b29ec48fe5e369fa111aa (diff)
parent8843e245bab25ed71d993949604253afe929b611 (diff)
downloadpuppet-sshkeys_core-45850cc69103259925d7f4f829b57b95dd173b89.tar.gz
puppet-sshkeys_core-45850cc69103259925d7f4f829b57b95dd173b89.tar.bz2
Merge pull request #46 from GabrielNagy/MODULES-10953/update-metadata
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/provider/ssh_authorized_key_spec.rb12
-rw-r--r--spec/integration/provider/sshkey_spec.rb11
2 files changed, 10 insertions, 13 deletions
diff --git a/spec/integration/provider/ssh_authorized_key_spec.rb b/spec/integration/provider/ssh_authorized_key_spec.rb
index 784415c..9e9801d 100644
--- a/spec/integration/provider/ssh_authorized_key_spec.rb
+++ b/spec/integration/provider/ssh_authorized_key_spec.rb
@@ -49,9 +49,9 @@ describe Puppet::Type.type(:ssh_authorized_key).provider(:parsed), unless: Puppe
end
before :each do
- File.stubs(:chown)
- File.stubs(:chmod)
- Puppet::Util::SUIDManager.stubs(:asuser).yields
+ allow(File).to receive(:chown)
+ allow(File).to receive(:chmod)
+ allow(Puppet::Util::SUIDManager).to receive(:asuser).and_yield
end
after :each do
@@ -74,18 +74,18 @@ describe Puppet::Type.type(:ssh_authorized_key).provider(:parsed), unless: Puppe
end
def run_in_catalog(*resources)
- Puppet::FileBucket::Dipper.any_instance.stubs(:backup) # rubocop:disable RSpec/AnyInstance
+ allow_any_instance_of(Puppet::FileBucket::Dipper).to receive(:backup) # rubocop:disable RSpec/AnyInstance
catalog = Puppet::Resource::Catalog.new
catalog.host_config = false
resources.each do |resource|
- resource.expects(:err).never
+ expect(resource).not_to receive(:err)
catalog.add_resource(resource)
end
catalog.apply
end
it 'does not complain about empty lines and comments' do
- described_class.expects(:flush).never
+ expect(described_class).not_to receive(:flush)
sample = ['', sample_lines[0], ' ', sample_lines[1], '# just a comment', '#and another']
create_fake_key(:user, sample)
run_in_catalog(dummy)
diff --git a/spec/integration/provider/sshkey_spec.rb b/spec/integration/provider/sshkey_spec.rb
index 74e56a7..6b92b56 100644
--- a/spec/integration/provider/sshkey_spec.rb
+++ b/spec/integration/provider/sshkey_spec.rb
@@ -12,10 +12,9 @@ describe Puppet::Type.type(:sshkey).provider(:parsed), unless: Puppet.features.m
before :each do
# Don't backup to filebucket
- Puppet::FileBucket::Dipper.any_instance.stubs(:backup) # rubocop:disable RSpec/AnyInstance
+ allow_any_instance_of(Puppet::FileBucket::Dipper).to receive(:backup) # rubocop:disable RSpec/AnyInstance
# We don't want to execute anything
- described_class.stubs(:filetype)
- .returns Puppet::Util::FileType::FileTypeFlat
+ allow(described_class).to receive(:filetype).and_return Puppet::Util::FileType::FileTypeFlat
FileUtils.cp(my_fixture('sample'), sshkey_file)
end
@@ -188,11 +187,9 @@ describe Puppet::Type.type(:sshkey).provider(:parsed), unless: Puppet.features.m
it 'fetches an entry from resources' do
resource_app = Puppet::Application[:resource]
resource_app.preinit
- resource_app.command_line
- .stubs(:args)
- .returns([type_under_test, sshkey_name, "target=#{sshkey_file}"])
+ allow(resource_app.command_line).to receive(:args).and_return([type_under_test, sshkey_name, "target=#{sshkey_file}"])
- resource_app.expects(:puts).with do |args|
+ expect(resource_app).to receive(:puts) do |args|
expect(args).to match(%r{#{sshkey_name}})
end
resource_app.main