summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface/action_builder_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/interface/action_builder_spec.rb')
-rwxr-xr-xspec/unit/interface/action_builder_spec.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/spec/unit/interface/action_builder_spec.rb b/spec/unit/interface/action_builder_spec.rb
index c39860591..602daaaca 100755
--- a/spec/unit/interface/action_builder_spec.rb
+++ b/spec/unit/interface/action_builder_spec.rb
@@ -8,7 +8,7 @@ describe Puppet::Interface::ActionBuilder do
it "should build an action" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
end
action.should be_a(Puppet::Interface::Action)
action.name.should == :foo
@@ -16,7 +16,7 @@ describe Puppet::Interface::ActionBuilder do
it "should define a method on the face which invokes the action" do
face = Puppet::Interface.new(:action_builder_test_interface, '0.0.1') do
- action(:foo) { when_invoked { "invoked the method" } }
+ action(:foo) { when_invoked { |options| "invoked the method" } }
end
face.foo.should == "invoked the method"
@@ -37,7 +37,7 @@ describe Puppet::Interface::ActionBuilder do
it "should have a #option DSL function" do
method = nil
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
method = self.method(:option)
end
method.should be_an_instance_of Method
@@ -45,7 +45,7 @@ describe Puppet::Interface::ActionBuilder do
it "should define an option without a block" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
option "--bar"
end
action.should be_option :bar
@@ -53,7 +53,7 @@ describe Puppet::Interface::ActionBuilder do
it "should accept an empty block" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
option "--bar" do
# This space left deliberately blank.
end
@@ -65,7 +65,7 @@ describe Puppet::Interface::ActionBuilder do
context "inline documentation" do
it "should set the summary" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
summary "this is some text"
end
action.summary.should == "this is some text"
@@ -75,7 +75,7 @@ describe Puppet::Interface::ActionBuilder do
context "action defaulting" do
it "should set the default to true" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
default
end
action.default.should be_true
@@ -83,7 +83,7 @@ describe Puppet::Interface::ActionBuilder do
it "should not be default by, er, default. *cough*" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
end
action.default.should be_false
end
@@ -93,7 +93,7 @@ describe Puppet::Interface::ActionBuilder do
it "should fail if no rendering format is given" do
expect {
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering do true end
end
}.to raise_error ArgumentError, /must give a rendering format to when_rendering/
@@ -102,7 +102,7 @@ describe Puppet::Interface::ActionBuilder do
it "should fail if no block is given" do
expect {
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering :json
end
}.to raise_error ArgumentError, /must give a block to when_rendering/
@@ -111,7 +111,7 @@ describe Puppet::Interface::ActionBuilder do
it "should fail if the block takes no arguments" do
expect {
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering :json do true end
end
}.to raise_error ArgumentError, /when_rendering methods take one argument, the result, not/
@@ -120,7 +120,7 @@ describe Puppet::Interface::ActionBuilder do
it "should fail if the block takes more than one argument" do
expect {
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering :json do |a, b, c| true end
end
}.to raise_error ArgumentError, /when_rendering methods take one argument, the result, not/
@@ -129,7 +129,7 @@ describe Puppet::Interface::ActionBuilder do
it "should fail if the block takes a variable number of arguments" do
expect {
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering :json do |*args| true end
end
}.to raise_error(ArgumentError,
@@ -138,7 +138,7 @@ describe Puppet::Interface::ActionBuilder do
it "should stash a rendering block" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering :json do |a| true end
end
action.when_rendering(:json).should be_an_instance_of Method
@@ -147,7 +147,7 @@ describe Puppet::Interface::ActionBuilder do
it "should fail if you try to set the same rendering twice" do
expect {
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering :json do |a| true end
when_rendering :json do |a| true end
end
@@ -156,7 +156,7 @@ describe Puppet::Interface::ActionBuilder do
it "should work if you set two different renderings" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering :json do |a| true end
when_rendering :yaml do |a| true end
end
@@ -166,7 +166,7 @@ describe Puppet::Interface::ActionBuilder do
it "should be bound to the face when called" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
when_rendering :json do |a| self end
end
action.when_rendering(:json).call(true).should == face
@@ -176,7 +176,7 @@ describe Puppet::Interface::ActionBuilder do
context "#render_as" do
it "should default to nil (eg: based on context)" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
end
action.render_as.should be_nil
end
@@ -184,7 +184,7 @@ describe Puppet::Interface::ActionBuilder do
it "should fail if not rendering format is given" do
expect {
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
render_as
end
}.to raise_error ArgumentError, /must give a rendering format to render_as/
@@ -193,7 +193,7 @@ describe Puppet::Interface::ActionBuilder do
Puppet::Network::FormatHandler.formats.each do |name|
it "should accept #{name.inspect} format" do
action = Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
render_as name
end
action.render_as.should == name
@@ -204,7 +204,7 @@ describe Puppet::Interface::ActionBuilder do
it "should fail if given #{input.inspect}" do
expect {
Puppet::Interface::ActionBuilder.build(face, :foo) do
- when_invoked do true end
+ when_invoked do |options| true end
render_as input
end
}.to raise_error ArgumentError, /#{input.inspect} is not a valid rendering format/