summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-11-11 20:25:28 +0100
committerJames Turnbull <james@lovedthanlost.net>2009-11-15 10:06:03 +1100
commit6c2daa36ded879763cfc1a6fac8f4e6d75a3cadb (patch)
tree8c6d3e64429e70d7ebf7544333cb291a388f7165 /spec
parent56486664f25f495182dd3e3708e760d4220b1199 (diff)
downloadpuppet-6c2daa36ded879763cfc1a6fac8f4e6d75a3cadb.tar.gz
puppet-6c2daa36ded879763cfc1a6fac8f4e6d75a3cadb.tar.xz
puppet-6c2daa36ded879763cfc1a6fac8f4e6d75a3cadb.zip
Fix #2783 - Puppetdoc rdoc should use environment to get modulepath/manifestdir
Puppetdoc wasn't using the current environment to find the correct modulepath and manifestdir. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/application/puppetdoc.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/unit/application/puppetdoc.rb b/spec/unit/application/puppetdoc.rb
index b9173752f..cb60581a4 100755
--- a/spec/unit/application/puppetdoc.rb
+++ b/spec/unit/application/puppetdoc.rb
@@ -290,16 +290,16 @@ describe "puppetdoc" do
@puppetdoc.manifest = false
Puppet.stubs(:info)
Puppet.stubs(:[]).with(:trace).returns(false)
- Puppet.stubs(:[]).with(:modulepath).returns('modules')
- Puppet.stubs(:[]).with(:manifestdir).returns('manifests')
+ @env = stub 'env'
+ Puppet::Node::Environment.stubs(:new).returns(@env)
+ @env.stubs(:modulepath).returns(['modules'])
+ @env.stubs(:manifestdir).returns(['manifests'])
@puppetdoc.options.stubs(:[]).with(:all).returns(false)
@puppetdoc.options.stubs(:[]).with(:outputdir).returns('doc')
Puppet.settings.stubs(:[]=).with(:document_all, false)
Puppet.settings.stubs(:setdefaults)
Puppet::Util::RDoc.stubs(:rdoc)
@puppetdoc.stubs(:exit)
- File.stubs(:expand_path).with('modules').returns('modules')
- File.stubs(:expand_path).with('manifests').returns('manifests')
@old = ARGV.dup
ARGV.clear
end
@@ -331,6 +331,15 @@ describe "puppetdoc" do
Puppet::Util::RDoc.expects(:manifestdoc)
@puppetdoc.rdoc
end
+
+ it "should get modulepath and manifestdir values from the environment" do
+ @env.expects(:modulepath).returns(['envmodules1','envmodules2'])
+ @env.expects(:manifestdir).returns(['envmanifests1','envmanifests2'])
+
+ Puppet::Util::RDoc.expects(:rdoc).with('doc', ['envmodules1','envmodules2','envmanifests1','envmanifests2'])
+
+ @puppetdoc.rdoc
+ end
end
describe "in the other modes" do