summaryrefslogtreecommitdiffstats
path: root/spec/shared_behaviours/file_serving.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-03-31 23:56:09 -0500
committerLuke Kanies <luke@madstop.com>2008-03-31 23:56:09 -0500
commit88dc49cb7b0efe757c92ce28c807b91335acb07a (patch)
tree13fe4561f1f524f97a8bb2c1ff84c1ef981d0241 /spec/shared_behaviours/file_serving.rb
parent4165edaeb71ee2883b1bb85ff39a52d5628b259f (diff)
parenta8592f1009040ebf30a98268610915cc33bb3f63 (diff)
downloadpuppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.tar.gz
puppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.tar.xz
puppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.zip
Merge branch 'master' into master_no_global_resources
Conflicts: lib/puppet/node/catalog.rb lib/puppet/type/pfile.rb lib/puppet/type/pfilebucket.rb lib/puppet/util/filetype.rb spec/unit/node/catalog.rb spec/unit/other/transbucket.rb spec/unit/ral/provider/mount/parsed.rb spec/unit/ral/types/file.rb spec/unit/ral/types/interface.rb spec/unit/ral/types/mount.rb spec/unit/ral/types/package.rb spec/unit/ral/types/schedule.rb spec/unit/ral/types/service.rb test/language/compile.rb test/language/lexer.rb test/language/snippets.rb test/lib/puppettest.rb test/ral/types/basic.rb test/ral/types/cron.rb test/ral/types/exec.rb test/ral/types/file.rb test/ral/types/file/target.rb test/ral/types/filebucket.rb test/ral/types/fileignoresource.rb test/ral/types/filesources.rb test/ral/types/group.rb test/ral/types/host.rb test/ral/types/parameter.rb test/ral/types/sshkey.rb test/ral/types/tidy.rb test/ral/types/user.rb test/ral/types/yumrepo.rb
Diffstat (limited to 'spec/shared_behaviours/file_serving.rb')
-rw-r--r--spec/shared_behaviours/file_serving.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/shared_behaviours/file_serving.rb b/spec/shared_behaviours/file_serving.rb
new file mode 100644
index 000000000..b5ab6b0fd
--- /dev/null
+++ b/spec/shared_behaviours/file_serving.rb
@@ -0,0 +1,54 @@
+#!/usr/bin/env ruby
+#
+# Created by Luke Kanies on 2007-10-18.
+# Copyright (c) 2007. All rights reserved.
+
+describe "Puppet::FileServing::Files", :shared => true do
+ it "should use the rest terminus when the 'puppet' URI scheme is used and a host name is present" do
+ uri = "puppet://myhost/mymod/my/file"
+ @indirection.terminus(:rest).expects(:find).with(uri)
+ @test_class.find(uri)
+ end
+
+ it "should use the rest terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is not 'puppet'" do
+ uri = "puppet:///mymod/my/file"
+ Puppet.settings.stubs(:value).with(:name).returns("puppetd")
+ Puppet.settings.stubs(:value).with(:modulepath).returns("")
+ @indirection.terminus(:rest).expects(:find).with(uri)
+ @test_class.find(uri)
+ end
+
+ it "should use the file_server terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is 'puppet'" do
+ uri = "puppet:///mymod/my/file"
+ Puppet::Node::Environment.stubs(:new).returns(stub("env", :name => "testing"))
+ Puppet.settings.stubs(:value).with(:name).returns("puppet")
+ Puppet.settings.stubs(:value).with(:modulepath, "testing").returns("")
+ Puppet.settings.stubs(:value).with(:modulepath).returns("")
+ Puppet.settings.stubs(:value).with(:libdir).returns("")
+ Puppet.settings.stubs(:value).with(:fileserverconfig).returns("/whatever")
+ Puppet.settings.stubs(:value).with(:environment).returns("")
+ @indirection.terminus(:file_server).expects(:find).with(uri)
+ @indirection.terminus(:file_server).stubs(:authorized?).returns(true)
+ @test_class.find(uri)
+ end
+
+ it "should use the file_server terminus when the 'puppetmounts' URI scheme is used" do
+ uri = "puppetmounts:///mymod/my/file"
+ @indirection.terminus(:file_server).expects(:find).with(uri)
+ @indirection.terminus(:file_server).stubs(:authorized?).returns(true)
+ @test_class.find(uri)
+ end
+
+ it "should use the file terminus when the 'file' URI scheme is used" do
+ uri = "file:///mymod/my/file"
+ @indirection.terminus(:file).expects(:find).with(uri)
+ @test_class.find(uri)
+ end
+
+ it "should use the file terminus when a fully qualified path is provided" do
+ uri = "/mymod/my/file"
+ @indirection.terminus(:file).expects(:find).with(uri)
+ @test_class.find(uri)
+ end
+end
+