summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface_spec.rb
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-17 19:20:49 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-19 10:33:22 -0700
commit266f937ed7d859fb2aee94c76e1a20539357c1eb (patch)
tree575c9d0497fdc1e9fd629dd73573ef410c3ed388 /spec/unit/interface_spec.rb
parent32c667c79bc0d5151580ea79719f28739945bfb1 (diff)
downloadpuppet-266f937ed7d859fb2aee94c76e1a20539357c1eb.tar.gz
puppet-266f937ed7d859fb2aee94c76e1a20539357c1eb.tar.xz
puppet-266f937ed7d859fb2aee94c76e1a20539357c1eb.zip
(#6962) Add 'description' to faces and action.
This adds the 'description' method to the faces and actions, as well as structured testing to ensure that the DSL works as expected. Reviewed-By: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'spec/unit/interface_spec.rb')
-rwxr-xr-xspec/unit/interface_spec.rb35
1 files changed, 14 insertions, 21 deletions
diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb
index 036372e6a..50ae9c711 100755
--- a/spec/unit/interface_spec.rb
+++ b/spec/unit/interface_spec.rb
@@ -33,7 +33,7 @@ describe Puppet::Interface do
describe "#define" do
it "should register the face" do
- face = subject.define(:face_test_register, '0.0.1')
+ face = subject.define(:face_test_register, '0.0.1')
face.should == subject[:face_test_register, '0.0.1']
end
@@ -50,6 +50,18 @@ describe Puppet::Interface do
subject.new(:foo, '1.0.0').should respond_to(:summary).with(0).arguments
subject.new(:foo, '1.0.0').should respond_to(:summary=).with(1).arguments
end
+
+ # Required documentation methods...
+ { :summary => "summary",
+ :description => "This is the description of the stuff\n\nWhee"
+ }.each do |attr, value|
+ it "should support #{attr} in the builder" do
+ face = subject.new(:builder, '1.0.0') do
+ self.send(attr, value)
+ end
+ face.send(attr).should == value
+ end
+ end
end
describe "#initialize" do
@@ -187,28 +199,9 @@ describe Puppet::Interface do
end
end
- context "documentation" do
+ it_should_behave_like "documentation on faces" do
subject do
Puppet::Interface.new(:face_documentation, '0.0.1')
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 \n embedded \n newlines" }.
- to raise_error ArgumentError, /summary should be a single line/
- end
- end
end
end