summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-08-11 17:07:11 -0700
committerNick Lewis <nick@puppetlabs.com>2011-08-11 17:07:11 -0700
commit75786ada2187283f21241a5377908ff3a8b3d694 (patch)
treeb5f1649589c3bab518011c212ca8614bfb552472 /spec
parentf7e96953b4e297ac1f78a1747e8dc3187c49870b (diff)
parentd7c9c765dbf28df3631e709832c44c343569cb53 (diff)
downloadpuppet-75786ada2187283f21241a5377908ff3a8b3d694.tar.gz
puppet-75786ada2187283f21241a5377908ff3a8b3d694.tar.xz
puppet-75786ada2187283f21241a5377908ff3a8b3d694.zip
Merge pull request #32 from joshcooper/ticket/2.6.x/8740-cannot-manage-files-of-type-socket
Ticket/2.6.x/8740 cannot manage files of type socket
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/application/resource_spec.rb25
-rwxr-xr-xspec/unit/type/file_spec.rb6
2 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb
index b6c52b11e..9059a1fc5 100755
--- a/spec/unit/application/resource_spec.rb
+++ b/spec/unit/application/resource_spec.rb
@@ -230,4 +230,29 @@ describe Puppet::Application::Resource do
end
end
+
+ describe "when handling file type" do
+ before :each do
+ Facter.stubs(:loadfacts)
+ @resource.preinit
+ end
+
+ it "should raise an exception if no file specified" do
+ @resource.command_line.stubs(:args).returns(['file'])
+
+ lambda { @resource.main }.should raise_error(RuntimeError, /Listing all file instances is not supported/)
+ end
+
+ it "should output a file resource when given a file path" do
+ res = Puppet::Type.type(:file).new(:path => "/etc").to_resource
+ Puppet::Resource.expects(:find).returns(res)
+
+ @resource.command_line.stubs(:args).returns(['file', '/etc'])
+ @resource.expects(:puts).with do |args|
+ args.should =~ /file \{ '\/etc'/m
+ end
+
+ @resource.main
+ end
+ end
end
diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb
index 90f3daf09..81ccee821 100755
--- a/spec/unit/type/file_spec.rb
+++ b/spec/unit/type/file_spec.rb
@@ -1190,4 +1190,10 @@ describe Puppet::Type.type(:file) do
@file[:checksum].should be :md5lite
end
end
+
+ describe ".instances" do
+ it 'should return an empty array' do
+ Puppet::Type::File.instances.should == []
+ end
+ end
end