summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-08-17 14:44:03 -0700
committerNick Lewis <nick@puppetlabs.com>2011-08-17 14:44:03 -0700
commitcf95530964a067374f2ff8be0602342e47a55cc5 (patch)
treeeeec7ada4ec86ededf527fe2108f839251e41869 /spec/unit/application
parent54fb365120463e240328cd6fe507423e6d022110 (diff)
parent99678f26369f7ac57a4125b6b391f2db832bbb4b (diff)
downloadpuppet-cf95530964a067374f2ff8be0602342e47a55cc5.tar.gz
puppet-cf95530964a067374f2ff8be0602342e47a55cc5.tar.xz
puppet-cf95530964a067374f2ff8be0602342e47a55cc5.zip
Merge branch '2.7.x'
Diffstat (limited to 'spec/unit/application')
-rwxr-xr-xspec/unit/application/resource_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb
index a6564cae5..01cd17e00 100755
--- a/spec/unit/application/resource_spec.rb
+++ b/spec/unit/application/resource_spec.rb
@@ -221,4 +221,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.indirection.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