summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-04-15 15:31:46 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-04-15 15:31:46 -0700
commit3fe01a34e8397c30a00e7d47b4ac0b93198e1fcf (patch)
tree22e20b8f58e2338ef684f6fdbb640d090e768516 /spec/unit/interface
parent64bc8345fd29f17ce7be53187d0acf3fc61d2b58 (diff)
parent9264526a7cd45c9ff5767bc6c85585eb19f01f63 (diff)
downloadpuppet-3fe01a34e8397c30a00e7d47b4ac0b93198e1fcf.tar.gz
puppet-3fe01a34e8397c30a00e7d47b4ac0b93198e1fcf.tar.xz
puppet-3fe01a34e8397c30a00e7d47b4ac0b93198e1fcf.zip
Merge branch 'tickets/2.7.x/7115' into 2.7.x
Diffstat (limited to 'spec/unit/interface')
-rwxr-xr-xspec/unit/interface/action_builder_spec.rb11
-rwxr-xr-xspec/unit/interface/action_manager_spec.rb18
2 files changed, 29 insertions, 0 deletions
diff --git a/spec/unit/interface/action_builder_spec.rb b/spec/unit/interface/action_builder_spec.rb
index 5b04df900..8f29c8a7b 100755
--- a/spec/unit/interface/action_builder_spec.rb
+++ b/spec/unit/interface/action_builder_spec.rb
@@ -65,5 +65,16 @@ describe Puppet::Interface::ActionBuilder do
action.summary.should == "this is some text"
end
end
+
+ context "action defaulting" do
+ let :face do Puppet::Interface.new(:default_action, '0.0.1') end
+
+ it "should set the default to true" do
+ action = Puppet::Interface::ActionBuilder.build(face, :foo) do
+ default
+ end
+ action.default.should == true
+ end
+ end
end
end
diff --git a/spec/unit/interface/action_manager_spec.rb b/spec/unit/interface/action_manager_spec.rb
index c4b21eaac..387faa043 100755
--- a/spec/unit/interface/action_manager_spec.rb
+++ b/spec/unit/interface/action_manager_spec.rb
@@ -3,6 +3,7 @@ require 'spec_helper'
# This is entirely an internal class for Interface, so we have to load it instead of our class.
require 'puppet/interface'
+require 'puppet/face'
class ActionManagerTester
include Puppet::Interface::ActionManager
@@ -213,6 +214,23 @@ describe Puppet::Interface::ActionManager do
end
end
+ describe "#action" do
+ it 'should add an action' do
+ subject.action(:foo) { }
+ subject.get_action(:foo).should be_a Puppet::Interface::Action
+ end
+
+ it 'should support default actions' do
+ subject.action(:foo) { default }
+ subject.get_default_action.should == subject.get_action(:foo)
+ end
+
+ it 'should not support more than one default action' do
+ subject.action(:foo) { default }
+ expect { subject.action(:bar) { default } }.should raise_error
+ end
+ end
+
describe "#get_action" do
let :parent_class do
parent_class = Class.new(Puppet::Interface)