diff options
author | Francois Deppierraz <francois.deppierraz@camptocamp.com> | 2008-07-02 16:18:06 +0200 |
---|---|---|
committer | Francois Deppierraz <francois.deppierraz@camptocamp.com> | 2008-07-02 16:18:06 +0200 |
commit | 5156230b434adbe6de6606f6bcd8843264b8dab4 (patch) | |
tree | 717ac7284c4014882151b24569ede191bcf06f67 /spec | |
parent | 8c5c949b37d3af4439c713e6c6e57e8f4b0415ac (diff) | |
download | puppet-5156230b434adbe6de6606f6bcd8843264b8dab4.tar.gz puppet-5156230b434adbe6de6606f6bcd8843264b8dab4.tar.xz puppet-5156230b434adbe6de6606f6bcd8843264b8dab4.zip |
Use generate instead of autorequire in the ssh_authorized_key type based on Luke's comments
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/type/ssh_authorized_key.rb | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/spec/unit/type/ssh_authorized_key.rb b/spec/unit/type/ssh_authorized_key.rb index 581420698..3c87decf1 100755 --- a/spec/unit/type/ssh_authorized_key.rb +++ b/spec/unit/type/ssh_authorized_key.rb @@ -14,6 +14,7 @@ describe ssh_authorized_key do @provider = stub 'provider', :class => @provider_class, :file_path => "/tmp/whatever", :clear => nil @provider_class.stubs(:new).returns(@provider) + @catalog = Puppet::Node::Catalog.new end it "should have a name parameter" do @@ -77,38 +78,48 @@ describe ssh_authorized_key do end it "should autorequire parent directories when user is given" do - key = @class.create( + @catalog.add_resource @class.create( :name => "Test", :key => "AAA", :type => "ssh-rsa", :ensure => :present, :user => "root") + @catalog.apply - key.autorequire.should_not == [] + target = File.expand_path("~root/.ssh") + @catalog.resource(:file, target).should be_an_instance_of(Puppet::Type.type(:file)) end it "should set target when user is given" do - key = @class.create( + @catalog.add_resource @class.create( :name => "Test", :key => "AAA", :type => "ssh-rsa", :ensure => :present, :user => "root") + @catalog.apply - key.should(:target).should == File.expand_path("~root/.ssh/authorized_keys") + target = File.expand_path("~root/.ssh/authorized_keys") + @catalog.resource(:file, target).should be_an_instance_of(Puppet::Type.type(:file)) end it "should autorequire parent directories when target is given" do - key = @class.create( + target = "/tmp/home/foo/bar/.ssh/authorized_keys" + + @catalog.add_resource @class.create( :name => "Test", :key => "AAA", :type => "ssh-rsa", :ensure => :present, - :target => "/tmp/home/foo/bar/.ssh/authorized_keys") + :target => target) + @catalog.apply - key.autorequire.should_not == [] + @catalog.resource(:file, target).should be_an_instance_of(Puppet::Type.type(:file)) end - after { @class.clear } + after do + @class.clear + @catalog.clear + end end |