summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-11 12:00:06 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-12 16:12:08 -0700
commit91c29a72e2b728e2d9ba495cd34b7354faa3852b (patch)
treec71b96ff050b52f999354e607e8d65e2281a4f37 /spec
parentd13a938b0abc604a7802cf41ff75a30ad6ccd192 (diff)
downloadpuppet-91c29a72e2b728e2d9ba495cd34b7354faa3852b.tar.gz
puppet-91c29a72e2b728e2d9ba495cd34b7354faa3852b.tar.xz
puppet-91c29a72e2b728e2d9ba495cd34b7354faa3852b.zip
(#6962) Extract summary from legacy applications for help.
We use a dubious, but effective, regexp match on the existing man(1) style help string for the application to extract the summary data. This should properly be implemented as a summary method down in the applications themselves... Paired-With: Matt Robinson <matt@puppetlabs.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/faces/help_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/unit/faces/help_spec.rb b/spec/unit/faces/help_spec.rb
index 87ff67948..1399abfef 100644
--- a/spec/unit/faces/help_spec.rb
+++ b/spec/unit/faces/help_spec.rb
@@ -66,4 +66,38 @@ describe Puppet::Faces[:help, '0.0.1'] do
it { should have_matching_element %r{ #{name} } }
end
end
+
+ context "when listing legacy applications" do
+ let :help do Puppet::Faces[:help, :current] end
+
+ # If we don't, these tests are ... less than useful, because they assume
+ # it. When this breaks you should consider ditching the entire feature
+ # and tests, but if not work out how to fake one. --daniel 2011-04-11
+ it "should have at least one legacy application" do
+ help.legacy_applications.should have_at_least(1).item
+ end
+
+ # Meh. This is nasty, but we can't control the other list; the specific
+ # bug that caused these to be listed is annoyingly subtle and has a nasty
+ # fix, so better to have a "fail if you do something daft" trigger in
+ # place here, I think. --daniel 2011-04-11
+ %w{faces_base indirection_base}.each do |name|
+ it "should not list the #{name} application" do
+ help.legacy_applications.should_not include name
+ end
+ end
+
+ Puppet::Faces[:help, :current].legacy_applications.each do |appname|
+ it "should list #{appname} in the help output" do
+ help.help.should have_matching_element %r{ #{appname} }
+ end
+
+ summary = Puppet::Faces[:help, :current].horribly_extract_summary_from(appname)
+ if summary then
+ it "should display the summary of #{appname}" do
+ help.help.should have_matching_element %r{ #{summary}\b}
+ end
+ end
+ end
+ end
end