diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-07-22 14:32:00 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-07-22 16:27:13 -0700 |
| commit | 77441be2299bbb96ab9f048855b0fd4c16eb7b5a (patch) | |
| tree | 880f8f21d347df97f5d29c1499298026986944a0 /spec/unit | |
| parent | 69b4e70ac2fa2b265f6c92d7de073d51ae25d3ed (diff) | |
| download | puppet-77441be2299bbb96ab9f048855b0fd4c16eb7b5a.tar.gz puppet-77441be2299bbb96ab9f048855b0fd4c16eb7b5a.tar.xz puppet-77441be2299bbb96ab9f048855b0fd4c16eb7b5a.zip | |
(#8561) Unify validation and modification of action arguments.
Rather than having multiple, separate operations that modify and validate the
arguments to an action, a single pass makes sense. This also means less walks
across the set of data, and a few less expensive method calls in Ruby.
Additionally, we work on a duplicate of the arguments hash rather than
directly modifying the original. Because everything we do is at the top level
key/value mapping, this is sufficient to isolate the original.
While mostly theoretical, we now don't mutilate the hash passed in, so the
user won't get nastily surprised by the fact that we could have done so.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/interface/action_spec.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb index 66fff2571..c1491488e 100755 --- a/spec/unit/interface/action_spec.rb +++ b/spec/unit/interface/action_spec.rb @@ -138,8 +138,8 @@ describe Puppet::Interface::Action do options.should == { :bar => "beer" } end - it "should call #validate_args on the action when invoked" do - face.get_action(:bar).expects(:validate_args).with([1, :two, 'three', {}]) + it "should call #validate_and_clean on the action when invoked" do + face.get_action(:bar).expects(:validate_and_clean).with([1, :two, 'three', {}]) face.bar 1, :two, 'three' end end @@ -548,7 +548,7 @@ describe Puppet::Interface::Action do it "should return the block if asked" end - context "#validate_args" do + context "#validate_and_clean" do subject do Puppet::Interface.new(:validate_args, '1.0.0') do script :test do |options| true end |
