summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-10-06 09:03:25 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-12-09 02:13:02 +1100
commit22c642df7e705792373c605422d368236e6f5a94 (patch)
treef96a905f551d66751a458acb2aa63a353caac07a /spec
parentadc211ad191568e84eb3e1f618f1cbf78df95ba9 (diff)
downloadpuppet-22c642df7e705792373c605422d368236e6f5a94.tar.gz
puppet-22c642df7e705792373c605422d368236e6f5a94.tar.xz
puppet-22c642df7e705792373c605422d368236e6f5a94.zip
Extracting language doc support into a module
This is so that you can still use docs without AST being the parent class. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/util/inline_docs.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/unit/util/inline_docs.rb b/spec/unit/util/inline_docs.rb
new file mode 100755
index 000000000..c541d01f0
--- /dev/null
+++ b/spec/unit/util/inline_docs.rb
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+
+Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
+
+require 'puppet/util/file_locking'
+
+class InlineDoccer
+ include Puppet::Util::InlineDocs
+end
+
+describe Puppet::Util::InlineDocs do
+ describe "when included" do
+ it "should create a class method for specifying that docs should be associated" do
+ InlineDoccer.expects(:use_docs=).with true
+ InlineDoccer.associates_doc
+ end
+
+ it "should default to not associating docs" do
+ (!! InlineDoccer.use_docs).should be_false
+ end
+
+ it "should create an instance method for setting documentation" do
+ instance = InlineDoccer.new
+ instance.doc = "foo"
+ instance.doc.should == "foo"
+ end
+
+ it "should default to an empty string for docs" do
+ InlineDoccer.new.doc.should == ""
+ end
+ end
+end