summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface/action_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/interface/action_spec.rb')
-rwxr-xr-xspec/unit/interface/action_spec.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb
index d71a7d000..848a44bba 100755
--- a/spec/unit/interface/action_spec.rb
+++ b/spec/unit/interface/action_spec.rb
@@ -171,14 +171,28 @@ 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"
+ describe "option aliases" do
+ let :option do action.get_option :bar end
+ let :action do face.get_action :foo end
+ let :face do
+ Puppet::Interface.new(:action_level_options, '0.0.1') do
+ action :foo do
+ when_invoked do |options| options end
+ option "--bar", "--foo", "-b"
+ end
+ end
+ end
+
+ it "should only list options and not aliases" do
+ action.options.should =~ [:bar]
+ end
+
+ it "should use the canonical option name when passed aliases" do
+ name = option.name
+ option.aliases.each do |input|
+ face.foo(input => 1).should == { name => 1 }
end
end
- face.get_action(:foo).options.should =~ [:bar]
end
describe "with both face and action options" do