diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 14:34:51 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 14:35:13 -0700 |
| commit | 4d2a367b0cf5bf03588b1e6bbfafdf437bea249e (patch) | |
| tree | 6f731f99d1e0e51ee4ba613851cc49b90633b27f /spec/unit | |
| parent | 75ef3af26fcd205f316358b2f23abe5e200f6eaf (diff) | |
| download | puppet-4d2a367b0cf5bf03588b1e6bbfafdf437bea249e.tar.gz puppet-4d2a367b0cf5bf03588b1e6bbfafdf437bea249e.tar.xz puppet-4d2a367b0cf5bf03588b1e6bbfafdf437bea249e.zip | |
(#6964) use 'when_invoked' rather than 'invoke' for actions.
In the DSL we want to use 'when_invoked do' because it reads much more
naturally for users.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/application/string_base_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/string/action_builder_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/string/action_manager_spec.rb | 50 | ||||
| -rwxr-xr-x | spec/unit/string/action_spec.rb | 16 | ||||
| -rwxr-xr-x | spec/unit/string_spec.rb | 2 |
5 files changed, 36 insertions, 36 deletions
diff --git a/spec/unit/application/string_base_spec.rb b/spec/unit/application/string_base_spec.rb index 71e67283d..753d911d1 100755 --- a/spec/unit/application/string_base_spec.rb +++ b/spec/unit/application/string_base_spec.rb @@ -23,7 +23,7 @@ describe Puppet::Application::StringBase do action :foo do option("--action") - invoke { |*args| args.length } + when_invoked { |*args| args.length } end end end diff --git a/spec/unit/string/action_builder_spec.rb b/spec/unit/string/action_builder_spec.rb index fde010d51..5f6f1c08f 100755 --- a/spec/unit/string/action_builder_spec.rb +++ b/spec/unit/string/action_builder_spec.rb @@ -15,7 +15,7 @@ describe Puppet::String::ActionBuilder do it "should define a method on the string which invokes the action" do string = Puppet::String.new(:action_builder_test_string, '0.0.1') action = Puppet::String::ActionBuilder.build(string, :foo) do - invoke do + when_invoked do "invoked the method" end end diff --git a/spec/unit/string/action_manager_spec.rb b/spec/unit/string/action_manager_spec.rb index 5ca55b387..b8baf80a5 100755 --- a/spec/unit/string/action_manager_spec.rb +++ b/spec/unit/string/action_manager_spec.rb @@ -15,7 +15,7 @@ describe Puppet::String::ActionManager do describe "when included in a class" do it "should be able to define an action" do subject.action(:foo) do - invoke { "something "} + when_invoked { "something "} end end @@ -27,10 +27,10 @@ describe Puppet::String::ActionManager do it "should be able to list defined actions" do subject.action(:foo) do - invoke { "something" } + when_invoked { "something" } end subject.action(:bar) do - invoke { "something" } + when_invoked { "something" } end subject.actions.should =~ [:foo, :bar] @@ -43,7 +43,7 @@ describe Puppet::String::ActionManager do it "should list both script and normal actions" do subject.action :foo do - invoke do "foo" end + when_invoked do "foo" end end subject.script :bar do "a bar is where beer is found" end @@ -52,7 +52,7 @@ describe Puppet::String::ActionManager do it "should be able to indicate when an action is defined" do subject.action(:foo) do - invoke { "something" } + when_invoked { "something" } end subject.should be_action(:foo) @@ -65,7 +65,7 @@ describe Puppet::String::ActionManager do it "should correctly treat action names specified as strings" do subject.action(:foo) do - invoke { "something" } + when_invoked { "something" } end subject.should be_action("foo") @@ -77,16 +77,16 @@ describe Puppet::String::ActionManager do it "should be able to define an action" do subject.action(:foo) do - invoke { "something "} + when_invoked { "something "} end end it "should be able to list defined actions" do subject.action(:foo) do - invoke { "something" } + when_invoked { "something" } end subject.action(:bar) do - invoke { "something" } + when_invoked { "something" } end subject.actions.should include(:bar) @@ -110,36 +110,36 @@ describe Puppet::String::ActionManager do it "should be able to define an action at the class level" do @klass.action(:foo) do - invoke { "something "} + when_invoked { "something "} end end it "should create an instance method when an action is defined at the class level" do @klass.action(:foo) do - invoke { "something" } + when_invoked { "something" } end @instance.foo.should == "something" end it "should be able to define an action at the instance level" do @instance.action(:foo) do - invoke { "something "} + when_invoked { "something "} end end it "should create an instance method when an action is defined at the instance level" do @instance.action(:foo) do - invoke { "something" } + when_invoked { "something" } end @instance.foo.should == "something" end it "should be able to list actions defined at the class level" do @klass.action(:foo) do - invoke { "something" } + when_invoked { "something" } end @klass.action(:bar) do - invoke { "something" } + when_invoked { "something" } end @klass.actions.should include(:bar) @@ -148,10 +148,10 @@ describe Puppet::String::ActionManager do it "should be able to list actions defined at the instance level" do @instance.action(:foo) do - invoke { "something" } + when_invoked { "something" } end @instance.action(:bar) do - invoke { "something" } + when_invoked { "something" } end @instance.actions.should include(:bar) @@ -160,10 +160,10 @@ describe Puppet::String::ActionManager do it "should be able to list actions defined at both instance and class level" do @klass.action(:foo) do - invoke { "something" } + when_invoked { "something" } end @instance.action(:bar) do - invoke { "something" } + when_invoked { "something" } end @instance.actions.should include(:bar) @@ -172,14 +172,14 @@ describe Puppet::String::ActionManager do it "should be able to indicate when an action is defined at the class level" do @klass.action(:foo) do - invoke { "something" } + when_invoked { "something" } end @instance.should be_action(:foo) end it "should be able to indicate when an action is defined at the instance level" do @klass.action(:foo) do - invoke { "something" } + when_invoked { "something" } end @instance.should be_action(:foo) end @@ -189,13 +189,13 @@ describe Puppet::String::ActionManager do @instance = @subclass.new @klass.action(:parent) do - invoke { "a" } + when_invoked { "a" } end @subclass.action(:sub) do - invoke { "a" } + when_invoked { "a" } end @instance.action(:instance) do - invoke { "a" } + when_invoked { "a" } end @instance.should be_action(:parent) @@ -208,7 +208,7 @@ describe Puppet::String::ActionManager do @instance = @subclass.new @klass.action(:foo) do - invoke { "something" } + when_invoked { "something" } end @instance.foo.should == "something" end diff --git a/spec/unit/string/action_spec.rb b/spec/unit/string/action_spec.rb index 1d25ff156..b6fe87a63 100755 --- a/spec/unit/string/action_spec.rb +++ b/spec/unit/string/action_spec.rb @@ -17,11 +17,11 @@ describe Puppet::String::Action do it "should be able to call other actions on the same object" do string = Puppet::String.new(:my_string, '0.0.1') do action(:foo) do - invoke { 25 } + when_invoked { 25 } end action(:bar) do - invoke { "the value of foo is '#{foo}'" } + when_invoked { "the value of foo is '#{foo}'" } end end string.foo.should == 25 @@ -35,25 +35,25 @@ describe Puppet::String::Action do it "should be able to call other actions on the same object when defined on a class" do class Puppet::String::MyStringBaseClass < Puppet::String action(:foo) do - invoke { 25 } + when_invoked { 25 } end action(:bar) do - invoke { "the value of foo is '#{foo}'" } + when_invoked { "the value of foo is '#{foo}'" } end action(:quux) do - invoke { "qux told me #{qux}" } + when_invoked { "qux told me #{qux}" } end end string = Puppet::String::MyStringBaseClass.new(:my_inherited_string, '0.0.1') do action(:baz) do - invoke { "the value of foo in baz is '#{foo}'" } + when_invoked { "the value of foo in baz is '#{foo}'" } end action(:qux) do - invoke { baz } + when_invoked { baz } end end string.foo.should == 25 @@ -67,7 +67,7 @@ describe Puppet::String::Action do let :string do Puppet::String.new(:ruby_api, '1.0.0') do action :bar do - invoke do |options| + when_invoked do |options| options end end diff --git a/spec/unit/string_spec.rb b/spec/unit/string_spec.rb index ddf855475..358668f9b 100755 --- a/spec/unit/string_spec.rb +++ b/spec/unit/string_spec.rb @@ -43,7 +43,7 @@ describe Puppet::String do it "should instance-eval any provided block" do face = Puppet::String.new(:string_test_block, '0.0.1') do action(:something) do - invoke { "foo" } + when_invoked { "foo" } end end |
