summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@rimspace.net>2011-02-12 12:09:27 -0800
committerDaniel Pittman <daniel@rimspace.net>2011-02-12 12:44:59 -0800
commite512e3effa134271564177e095c6afc19bebe62f (patch)
tree40c1b73355236134cebe08e7ba734aa78bf5c2ad /spec
parent16e79f075622aa155a112d5a271c386f4ebc0241 (diff)
downloadpuppet-e512e3effa134271564177e095c6afc19bebe62f.tar.gz
puppet-e512e3effa134271564177e095c6afc19bebe62f.tar.xz
puppet-e512e3effa134271564177e095c6afc19bebe62f.zip
(#5977) fix spec test failure when new applications are introduced.
The test here was previously fragile, in that it would break when new applications were introduced, and in that it depended on the order of items returned from reading the directories on disk. It is now insensitive to those changes, and still verifies that the results we require occur, reducing long term maintenance cost. Reviewed-by: James Turnbull <james@puppetlabs.com>
Diffstat (limited to 'spec')
-rwxr-xr-x[-rw-r--r--]spec/unit/util/command_line_spec.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb
index a648eb4a1..98ddb92f6 100644..100755
--- a/spec/unit/util/command_line_spec.rb
+++ b/spec/unit/util/command_line_spec.rb
@@ -108,8 +108,8 @@ describe Puppet::Util::CommandLine do
end
describe 'when loading commands' do
before do
- @core_apps = ["describe", "filebucket", "kick", "queue", "resource", "agent", "cert", "apply", "doc", "master"]
- @command_line = Puppet::Util::CommandLine.new("foo", %w{ client --help w hatever.pp }, @tty )
+ @core_apps = %w{describe filebucket kick queue resource agent cert apply doc master}
+ @command_line = Puppet::Util::CommandLine.new("foo", %w{ client --help whatever.pp }, @tty )
end
it 'should be able to find all existing commands' do
@core_apps.each do |command|
@@ -122,10 +122,15 @@ describe Puppet::Util::CommandLine do
@appdir="#{@dir}/puppet/application"
FileUtils.mkdir_p(@appdir)
FileUtils.touch("#{@appdir}/foo.rb")
- $LOAD_PATH.unshift(@dir)
+ $LOAD_PATH.unshift(@dir) # WARNING: MUST MATCH THE AFTER ACTIONS!
end
it 'should be able to find commands from both paths' do
- @command_line.available_subcommands.should == ['foo'] + @core_apps
+ found = @command_line.available_subcommands
+ found.should include 'foo'
+ @core_apps.each { |cmd| found.should include cmd }
+ end
+ after do
+ $LOAD_PATH.shift # WARNING: MUST MATCH THE BEFORE ACTIONS!
end
end
end