summaryrefslogtreecommitdiffstats
path: root/spec/unit/file_serving/mount/plugins.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/file_serving/mount/plugins.rb')
-rwxr-xr-xspec/unit/file_serving/mount/plugins.rb79
1 files changed, 39 insertions, 40 deletions
diff --git a/spec/unit/file_serving/mount/plugins.rb b/spec/unit/file_serving/mount/plugins.rb
index b3a32b70d..d8c05a2bd 100755
--- a/spec/unit/file_serving/mount/plugins.rb
+++ b/spec/unit/file_serving/mount/plugins.rb
@@ -3,60 +3,59 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
require 'puppet/file_serving/mount/plugins'
-describe Puppet::FileServing::Mount::Plugins, "when finding files" do
+describe Puppet::FileServing::Mount::Plugins do
before do
- @mount = Puppet::FileServing::Mount::Plugins.new("modules")
- end
-
- it "should use the provided environment to find the modules" do
- env = mock 'env'
- env.expects(:modules).returns []
+ @mount = Puppet::FileServing::Mount::Plugins.new("plugins")
- @mount.find("foo", env)
+ @environment = stub 'environment', :module => nil
+ @request = stub 'request', :environment => @environment
end
- it "should return nil if no module can be found with a matching plugin" do
- mod = mock 'module'
- mod.stubs(:plugin).with("foo/bar").returns nil
+ describe "when finding files" do
+ it "should use the provided environment to find the modules" do
+ @environment.expects(:modules).returns []
- env = stub 'env', :modules => []
- @mount.find("foo/bar", env).should be_nil
- end
+ @mount.find("foo", @request)
+ end
- it "should return the file path from the module" do
- mod = mock 'module'
- mod.stubs(:plugin).with("foo/bar").returns "eh"
+ it "should return nil if no module can be found with a matching plugin" do
+ mod = mock 'module'
+ mod.stubs(:plugin).with("foo/bar").returns nil
- env = stub 'env', :modules => [mod]
- @mount.find("foo/bar", env).should == "eh"
- end
-end
+ @environment.stubs(:modules).returns [mod]
+ @mount.find("foo/bar", @request).should be_nil
+ end
-describe Puppet::FileServing::Mount::Plugins, "when searching for files" do
- before do
- @mount = Puppet::FileServing::Mount::Plugins.new("modules")
+ it "should return the file path from the module" do
+ mod = mock 'module'
+ mod.stubs(:plugin).with("foo/bar").returns "eh"
+
+ @environment.stubs(:modules).returns [mod]
+ @mount.find("foo/bar", @request).should == "eh"
+ end
end
- it "should use the node's environment to find the modules" do
- env = mock 'env'
- env.expects(:modules).returns []
+ describe "when searching for files" do
+ it "should use the node's environment to find the modules" do
+ @environment.expects(:modules).returns []
- @mount.search("foo", env)
- end
+ @mount.search("foo", @request)
+ end
- it "should return nil if no modules can be found that have plugins" do
- mod = mock 'module'
- mod.stubs(:plugins?).returns false
+ it "should return nil if no modules can be found that have plugins" do
+ mod = mock 'module'
+ mod.stubs(:plugins?).returns false
- env = stub 'env', :modules => []
- @mount.search("foo/bar", env).should be_nil
- end
+ @environment.stubs(:modules).returns []
+ @mount.search("foo/bar", @request).should be_nil
+ end
- it "should return the plugin paths for each module that has plugins" do
- one = stub 'module', :plugins? => true, :plugin_directory => "/one"
- two = stub 'module', :plugins? => true, :plugin_directory => "/two"
+ it "should return the plugin paths for each module that has plugins" do
+ one = stub 'module', :plugins? => true, :plugin_directory => "/one"
+ two = stub 'module', :plugins? => true, :plugin_directory => "/two"
- env = stub 'env', :modules => [one, two]
- @mount.search("foo/bar", env).should == %w{/one /two}
+ @environment.stubs(:modules).returns [one, two]
+ @mount.search("foo/bar", @request).should == %w{/one /two}
+ end
end
end