diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-01-02 11:01:24 +1100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-01-02 11:01:24 +1100 |
commit | ebe5cc0979b57517f81c84a4d3ee771c12c6a19f (patch) | |
tree | d528a4ede6b06cf66e4e1ac9e24c844d73630ed1 /spec/shared_behaviours/file_server_terminus.rb | |
parent | aed51b4818d64e97778e7e959f258586a36519ad (diff) | |
parent | efd035b73299efd19302cd47edacd5b860a2af55 (diff) | |
download | puppet-ebe5cc0979b57517f81c84a4d3ee771c12c6a19f.tar.gz puppet-ebe5cc0979b57517f81c84a4d3ee771c12c6a19f.tar.xz puppet-ebe5cc0979b57517f81c84a4d3ee771c12c6a19f.zip |
Merge branch 'master' of git://reductivelabs.com/puppet
Diffstat (limited to 'spec/shared_behaviours/file_server_terminus.rb')
-rw-r--r-- | spec/shared_behaviours/file_server_terminus.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/shared_behaviours/file_server_terminus.rb b/spec/shared_behaviours/file_server_terminus.rb new file mode 100644 index 000000000..de08f29fc --- /dev/null +++ b/spec/shared_behaviours/file_server_terminus.rb @@ -0,0 +1,40 @@ +#!/usr/bin/env ruby +# +# Created by Luke Kanies on 2007-10-18. +# Copyright (c) 2007. All rights reserved. + +describe "Puppet::Indirector::FileServerTerminus", :shared => true do + # This only works if the shared behaviour is included before + # the 'before' block in the including context. + before do + Puppet::FileServing::Configuration.clear_cache + FileTest.stubs(:exists?).with(Puppet[:fileserverconfig]).returns(true) + FileTest.stubs(:exists?).with("/my/mount/path").returns(true) + FileTest.stubs(:directory?).with("/my/mount/path").returns(true) + FileTest.stubs(:readable?).with("/my/mount/path").returns(true) + + # Use a real mount, so the integration is a bit deeper. + @mount1 = Puppet::FileServing::Configuration::Mount.new("one") + @mount1.path = "/my/mount/path" + + @parser = stub 'parser', :changed? => false + @parser.stubs(:parse).returns("one" => @mount1) + + Puppet::FileServing::Configuration::Parser.stubs(:new).returns(@parser) + + # Stub out the modules terminus + @modules = mock 'modules terminus' + end + + it "should use the file server configuration to find files" do + @modules.stubs(:find).returns(nil) + @terminus.indirection.stubs(:terminus).with(:modules).returns(@modules) + + path = "/my/mount/path/my/file" + FileTest.stubs(:exists?).with(path).returns(true) + FileTest.stubs(:exists?).with("/my/mount/path").returns(true) + @mount1.expects(:file).with("my/file", :node => nil).returns(path) + + @terminus.find("puppetmounts://myhost/one/my/file").should be_instance_of(@test_class) + end +end |