diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-15 15:34:06 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-15 15:34:06 -0700 |
| commit | d80500f42367fa30a00dc12ef4b32b55b350b1ca (patch) | |
| tree | bdcdbc0ec51343e7c5057868bde6b1a4abcf004c /spec/unit/face | |
| parent | ab541fa0976bdce395a072bf0c391146b99d4219 (diff) | |
| download | puppet-d80500f42367fa30a00dc12ef4b32b55b350b1ca.tar.gz puppet-d80500f42367fa30a00dc12ef4b32b55b350b1ca.tar.xz puppet-d80500f42367fa30a00dc12ef4b32b55b350b1ca.zip | |
maint: speed up testing output of the help face.
We were generating the help output multiple times and testing it for multiple
properties; now we generate it once and test it multiple times. This makes
for less clear error reporting, but saving dozens of calls at ~ 1/3rd a second
each is worth it.
Paired-With: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'spec/unit/face')
| -rwxr-xr-x | spec/unit/face/help_spec.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/spec/unit/face/help_spec.rb b/spec/unit/face/help_spec.rb index e67f29e07..b5205afd6 100755 --- a/spec/unit/face/help_spec.rb +++ b/spec/unit/face/help_spec.rb @@ -55,19 +55,23 @@ describe Puppet::Face[:help, '0.0.1'] do end end - Puppet::Face.faces.each do |name| - face = Puppet::Face[name, :current] - summary = face.summary + it "should list all faces" do + Puppet::Face.faces.each do |name| + face = Puppet::Face[name, :current] + summary = face.summary - it { should =~ %r{ #{name} } } - it { should =~ %r{ #{name} +#{summary}} } if summary + subject.should =~ %r{ #{name} } + summary and subject.should =~ %r{ #{name} +#{summary}} + end end - Puppet::Face[:help, :current].legacy_applications.each do |appname| - it { should =~ %r{ #{appname} } } + it "should list all legacy applications" do + Puppet::Face[:help, :current].legacy_applications.each do |appname| + subject.should =~ %r{ #{appname} } - summary = Puppet::Face[:help, :current].horribly_extract_summary_from(appname) - summary and it { should =~ %r{ #{summary}\b} } + summary = Puppet::Face[:help, :current].horribly_extract_summary_from(appname) + summary and subject.should =~ %r{ #{summary}\b} + end end end |
