summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorDan Bode <dan@puppetlabs.com>2011-07-13 15:38:32 -0700
committerDan Bode <dan@puppetlabs.com>2011-07-13 15:38:32 -0700
commitb82f29c61aa84a12fc208487e4b049cb24702261 (patch)
tree13940fcc93d0409a648511b18478cf073717d58d /spec/unit
parent8730b290c4f45f3f76d57d2648bfb642528d0762 (diff)
downloadpuppet-b82f29c61aa84a12fc208487e4b049cb24702261.tar.gz
puppet-b82f29c61aa84a12fc208487e4b049cb24702261.tar.xz
puppet-b82f29c61aa84a12fc208487e4b049cb24702261.zip
(#7699) Help command should only list options once
The problem was caused by the fact that the options method returns a list of options that treated the aliases as seperate options. The fix is to only maintain a list of options and not add all aliases to the options list.
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/interface/action_spec.rb10
-rwxr-xr-xspec/unit/interface_spec.rb8
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb
index cf8d61d51..23216e7b4 100755
--- a/spec/unit/interface/action_spec.rb
+++ b/spec/unit/interface/action_spec.rb
@@ -171,6 +171,16 @@ describe Puppet::Interface::Action do
face.get_action(:foo).options.should =~ [:bar]
end
+ it "should only list options and not aliases" do
+ face = Puppet::Interface.new(:action_level_options, '0.0.1') do
+ action :foo do
+ when_invoked do |options| true end
+ option "--bar", "-b", "--foo-bar"
+ end
+ end
+ face.get_action(:foo).options.should =~ [:bar]
+ end
+
describe "with both face and action options" do
let :face do
Puppet::Interface.new(:action_level_options, '0.0.1') do
diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb
index 8bbbcc857..4cb1f8743 100755
--- a/spec/unit/interface_spec.rb
+++ b/spec/unit/interface_spec.rb
@@ -174,6 +174,14 @@ describe Puppet::Interface do
face.get_action(:foo).options.should =~ [:quux]
face.get_action(:bar).options.should =~ [:quux]
end
+
+ it "should only list options and not aliases" do
+ face = subject.new(:face_options, '0.0.1') do
+ option "--bar", "-b", "--foo-bar"
+ end
+ face.options.should =~ [:bar]
+ end
+
end
describe "with inherited options" do