summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/loaded_code.rb
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-07-23 23:09:34 +0200
committerJames Turnbull <james@lovedthanlost.net>2009-07-24 09:48:16 +1000
commitd95b687045920c7d7fed5da1fe03b0feac86327a (patch)
treea470f6ed0f6d16d8f51e50db3b6135650a90fa23 /spec/unit/parser/loaded_code.rb
parentef5c4aeb1f58bd37e8b4ea0fa17fbdbc2fbf7677 (diff)
downloadpuppet-d95b687045920c7d7fed5da1fe03b0feac86327a.tar.gz
puppet-d95b687045920c7d7fed5da1fe03b0feac86327a.tar.xz
puppet-d95b687045920c7d7fed5da1fe03b0feac86327a.zip
Fix #2439 - let puppetdoc use loaded_code
Since there isn't any unit test for puppetdoc rdoc code (my fault), nobody noticed it was using direct access to the parser AST array. This changeset fixes the way puppetdoc uses the parser results. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/parser/loaded_code.rb')
-rw-r--r--spec/unit/parser/loaded_code.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/parser/loaded_code.rb b/spec/unit/parser/loaded_code.rb
index 50f6b930c..d2986bf2c 100644
--- a/spec/unit/parser/loaded_code.rb
+++ b/spec/unit/parser/loaded_code.rb
@@ -25,6 +25,13 @@ describe Puppet::Parser::LoadedCode do
it "should return nil when asked for a #{data} that has not been added" do
Puppet::Parser::LoadedCode.new.send(data, "foo").should be_nil
end
+
+ it "should be able to retrieve all #{data}s" do
+ plurals = { "hostclass" => "hostclasses", "node" => "nodes", "definition" => "definitions" }
+ loader = Puppet::Parser::LoadedCode.new
+ loader.send("add_" + data , "foo", "bar")
+ loader.send(plurals[data]).should == { "foo" => "bar" }
+ end
end
describe "when finding a qualified instance" do