summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-17 18:51:09 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-19 10:33:08 -0700
commit32c667c79bc0d5151580ea79719f28739945bfb1 (patch)
treeed3857858710603fc771e9183b7155b91708bab4 /spec/unit/interface
parent0d0318f9f0eadff7f9934d3d02a7081bba05164c (diff)
downloadpuppet-32c667c79bc0d5151580ea79719f28739945bfb1.tar.gz
puppet-32c667c79bc0d5151580ea79719f28739945bfb1.tar.xz
puppet-32c667c79bc0d5151580ea79719f28739945bfb1.zip
(#7132) Reject 'summary' text with newlines embedded.
Our summary documentation is used to provide single-line context to faces, actions, and other items. To support this we hard-fail if someone tries to use the summary to embed the long documentation, and point them to the right place to add the extended text. Reviewed-By: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'spec/unit/interface')
-rwxr-xr-xspec/unit/interface/action_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb
index 4be6a1c55..602e51314 100755
--- a/spec/unit/interface/action_spec.rb
+++ b/spec/unit/interface/action_spec.rb
@@ -348,4 +348,32 @@ describe Puppet::Interface::Action do
end
end
end
+
+ context "documentation" do
+ subject do
+ face = Puppet::Interface.new(:action_documentation, '0.0.1') do
+ action :documentation do end
+ end
+ face.get_action(:documentation)
+ end
+
+ describe "#summary" do
+ it "should accept a summary" do
+ text = "this is my summary"
+ expect { subject.summary = text }.not_to raise_error
+ subject.summary.should == text
+ end
+
+ it "should accept a long, long, long summary" do
+ text = "I never know when to stop with the word banana" + ("na" * 1000)
+ expect { subject.summary = text }.not_to raise_error
+ subject.summary.should == text
+ end
+
+ it "should reject a summary with a newline" do
+ expect { subject.summary = "with\nnewlines" }.
+ to raise_error ArgumentError, /summary should be a single line/
+ end
+ end
+ end
end