summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-03-05 17:13:17 -0600
committerLuke Kanies <luke@madstop.com>2009-03-05 17:13:17 -0600
commit71e4919f6b60b36b9ba0b02d3619c0fb5e4df445 (patch)
treee616c169ef7b1909d20ab92624fb5d8857c1adfb /spec/unit
parent09bee9137d7a6415609a8abfdf727ee0361139e0 (diff)
downloadpuppet-71e4919f6b60b36b9ba0b02d3619c0fb5e4df445.tar.gz
puppet-71e4919f6b60b36b9ba0b02d3619c0fb5e4df445.tar.xz
puppet-71e4919f6b60b36b9ba0b02d3619c0fb5e4df445.zip
Moving default fileserving mount creation to the Configuration class
It was previously in the parser, but the parser is only created if the fileserver.conf exists, so the default mounts weren't made if the file didn't exist. This is a bit less encapsulation, but not much. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/file_serving/configuration.rb15
-rwxr-xr-xspec/unit/file_serving/configuration/parser.rb12
2 files changed, 15 insertions, 12 deletions
diff --git a/spec/unit/file_serving/configuration.rb b/spec/unit/file_serving/configuration.rb
index e62423caf..6f5dc115f 100755
--- a/spec/unit/file_serving/configuration.rb
+++ b/spec/unit/file_serving/configuration.rb
@@ -94,6 +94,21 @@ describe Puppet::FileServing::Configuration do
config.send(:readconfig, false)
config.mounted?("one").should be_true
end
+
+ it "should add modules and plugins mounts even if the file does not exist" do
+ FileTest.expects(:exists?).returns false # the file doesn't exist
+ config = Puppet::FileServing::Configuration.create
+ config.mounted?("modules").should be_true
+ config.mounted?("plugins").should be_true
+ end
+
+ it "should add modules and plugins mounts even if they are not returned by the parser" do
+ @parser.expects(:parse).returns("one" => mock("mount"))
+ FileTest.expects(:exists?).returns true # the file doesn't exist
+ config = Puppet::FileServing::Configuration.create
+ config.mounted?("modules").should be_true
+ config.mounted?("plugins").should be_true
+ end
end
describe "when finding the specified mount" do
diff --git a/spec/unit/file_serving/configuration/parser.rb b/spec/unit/file_serving/configuration/parser.rb
index 389e58389..6faf81b4c 100755
--- a/spec/unit/file_serving/configuration/parser.rb
+++ b/spec/unit/file_serving/configuration/parser.rb
@@ -32,10 +32,6 @@ describe Puppet::FileServing::Configuration::Parser do
describe Puppet::FileServing::Configuration::Parser, " when parsing" do
include FSConfigurationParserTesting
- before do
- @parser.stubs(:add_modules_mount)
- end
-
it "should allow comments" do
@filehandle.expects(:each).yields("# this is a comment\n")
proc { @parser.parse }.should_not raise_error
@@ -68,14 +64,6 @@ describe Puppet::FileServing::Configuration::Parser do
result["two"].should equal(mount2)
end
- it "should add plugins and modules mounts if they do not exist" do
- mock_file_content "[one]\npath /foo"
-
- result = @parser.parse
- result["plugins"].should_not be_nil
- result["modules"].should_not be_nil
- end
-
it "should only allow mount names that are alphanumeric plus dashes" do
mock_file_content "[a*b]\n"
proc { @parser.parse }.should raise_error(ArgumentError)