summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-07-22 15:15:38 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-07-22 16:27:17 -0700
commit82e5fa9561e2d4cb1d699a41c14f50953d8f2d97 (patch)
tree0df936ad4a379d01ad6249b23e00ca297caa58ec /spec/unit
parent77441be2299bbb96ab9f048855b0fd4c16eb7b5a (diff)
downloadpuppet-82e5fa9561e2d4cb1d699a41c14f50953d8f2d97.tar.gz
puppet-82e5fa9561e2d4cb1d699a41c14f50953d8f2d97.tar.xz
puppet-82e5fa9561e2d4cb1d699a41c14f50953d8f2d97.zip
(#8561, #7290) Implement the option contract fully.
Rewrite the process of validating and updating the options to fully reflect the contract - we fail if there are unknown options passed, report nicely errors of duplicate names, pass only the canonical names to the action code, and generally enforce nicely. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/interface/action_spec.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb
index c1491488e..c3f08e817 100755
--- a/spec/unit/interface/action_spec.rb
+++ b/spec/unit/interface/action_spec.rb
@@ -121,6 +121,7 @@ describe Puppet::Interface::Action do
let :face do
Puppet::Interface.new(:ruby_api, '1.0.0') do
action :bar do
+ option "--bar"
when_invoked do |*args|
args.last
end
@@ -139,7 +140,7 @@ describe Puppet::Interface::Action do
end
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.get_action(:bar).expects(:validate_and_clean).with({}).returns({})
face.bar 1, :two, 'three'
end
end
@@ -450,12 +451,12 @@ describe Puppet::Interface::Action do
end
it "should be invoked when calling a child action" do
- subject.on_child(:foo => true, :bar => true).should == :on_child
+ subject.on_child(:foo => true).should == :on_child
subject.reported.should == [ :child_before ]
end
it "should be invoked when calling a parent action" do
- subject.on_parent(:foo => true, :bar => true).should == :on_parent
+ subject.on_parent(:foo => true).should == :on_parent
subject.reported.should == [ :child_before ]
end
end
@@ -467,12 +468,12 @@ describe Puppet::Interface::Action do
end
it "should be invoked when calling a child action" do
- subject.on_child(:foo => true, :bar => true).should == :on_child
+ subject.on_child(:foo => true).should == :on_child
subject.reported.should == [ :parent_before ]
end
it "should be invoked when calling a parent action" do
- subject.on_parent(:foo => true, :bar => true).should == :on_parent
+ subject.on_parent(:foo => true).should == :on_parent
subject.reported.should == [ :parent_before ]
end
end