summaryrefslogtreecommitdiffstats
path: root/spec/unit/application/interface_base_spec.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2011-02-23 00:20:15 -0800
committerLuke Kanies <luke@puppetlabs.com>2011-02-23 00:20:15 -0800
commit59a648502a8f09948bd2d25a72a9099f7740e108 (patch)
tree3de97951a28a4710df603b86b69dec67211280bb /spec/unit/application/interface_base_spec.rb
parent4fa54d02a2806e8fde54da9bb7e4d6735b3cffe4 (diff)
Adding Application options to Interfaces
This allows all of the actions to react to the CLI options. I've also removed the unnecessary 'name' variables I was using in various places - they were just the first of the arguments, and they weren't actually always names. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'spec/unit/application/interface_base_spec.rb')
-rw-r--r--spec/unit/application/interface_base_spec.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/unit/application/interface_base_spec.rb b/spec/unit/application/interface_base_spec.rb
index c20be1142..4ef3869c2 100644
--- a/spec/unit/application/interface_base_spec.rb
+++ b/spec/unit/application/interface_base_spec.rb
@@ -11,6 +11,7 @@ end
describe Puppet::Application::InterfaceBase do
before do
@app = Puppet::Application::InterfaceBase::Basetest.new
+ @app.stubs(:interface).returns base_interface
@app.stubs(:exit)
@app.stubs(:puts)
end
@@ -18,8 +19,7 @@ describe Puppet::Application::InterfaceBase do
describe "when calling main" do
before do
@app.verb = :find
- @app.name = "myname"
- @app.arguments = "myarg"
+ @app.arguments = ["myname", "myarg"]
@app.interface.stubs(:find)
end
@@ -33,4 +33,18 @@ describe Puppet::Application::InterfaceBase do
it "should exit with the current exit code"
end
+
+ describe "during setup" do
+ before do
+ @app.command_line.stubs(:args).returns("find", "myname", "myarg")
+ @app.stubs(:validate)
+ end
+
+ it "should set the options on the interface" do
+ @app.options[:foo] = "bar"
+ @app.setup
+
+ @app.interface.options.should == @app.options
+ end
+ end
end