aboutsummaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorCiprian Badescu <ciprian.badescu@puppet.com>2020-02-20 15:32:52 +0200
committerCiprian Badescu <ciprian.badescu@puppet.com>2020-02-25 14:27:27 +0200
commit92a734a6620fcc51691d60347e344f87ac801bde (patch)
tree8309796c9485c084ec87cd84d26d17ecfb904213 /spec/unit
parent9f710d8e502b5bf2ca3d213d2bddea13f7a4b7b8 (diff)
downloadpuppet-sshkeys_core-92a734a6620fcc51691d60347e344f87ac801bde.tar.gz
puppet-sshkeys_core-92a734a6620fcc51691d60347e344f87ac801bde.tar.bz2
(MODULES-7613) use name and type as composite namevar
After this modification it will be possible to add two or more keys of different types for the same host
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/type/sshkey_spec.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/unit/type/sshkey_spec.rb b/spec/unit/type/sshkey_spec.rb
index 452610e..680d9ec 100644
--- a/spec/unit/type/sshkey_spec.rb
+++ b/spec/unit/type/sshkey_spec.rb
@@ -1,18 +1,19 @@
require 'spec_helper'
+require 'pry'
describe Puppet::Type.type(:sshkey) do
- it 'uses :name as its namevar' do
- expect(described_class.key_attributes).to eq [:name]
+ it 'uses :name and :type as its namevar' do
+ expect(described_class.key_attributes).to eq [:type, :name]
end
describe 'when validating attributes' do
- [:name, :provider].each do |param|
+ [:name, :provider, :type].each do |param|
it "has a #{param} parameter" do
expect(described_class.attrtype(param)).to eq :param
end
end
- [:host_aliases, :ensure, :key, :type].each do |property|
+ [:host_aliases, :ensure, :key].each do |property|
it "has a #{property} property" do
expect(described_class.attrtype(property)).to eq :property
end
@@ -35,12 +36,12 @@ describe Puppet::Type.type(:sshkey) do
it 'aliases :rsa to :ssh-rsa' do
key = described_class.new(name: 'foo', type: :rsa)
- expect(key.should(:type)).to eq :'ssh-rsa'
+ expect(key.parameter(:type).value).to eq :'ssh-rsa'
end
it 'aliases :dsa to :ssh-dss' do
key = described_class.new(name: 'foo', type: :dsa)
- expect(key.should(:type)).to eq :'ssh-dss'
+ expect(key.parameter(:type).value).to eq :'ssh-dss'
end
it "doesn't support values other than ssh-dss, ssh-rsa, dsa, rsa for type" do