summaryrefslogtreecommitdiffstats
path: root/spec/unit/application/string_base_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/application/string_base_spec.rb')
-rwxr-xr-xspec/unit/application/string_base_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/unit/application/string_base_spec.rb b/spec/unit/application/string_base_spec.rb
index cd24b6c49..3f8ae73b6 100755
--- a/spec/unit/application/string_base_spec.rb
+++ b/spec/unit/application/string_base_spec.rb
@@ -42,6 +42,15 @@ describe Puppet::Application::StringBase do
app
end
+ describe "#find_global_settings_argument" do
+ it "should not match --ca to --ca-location" do
+ option = mock('ca option', :optparse_args => ["--ca"])
+ Puppet.settings.expects(:each).yields(:ca, option)
+
+ app.find_global_settings_argument("--ca-location").should be_nil
+ end
+ end
+
describe "#preinit" do
before :each do
app.command_line.stubs(:args).returns %w{}
@@ -118,6 +127,26 @@ describe Puppet::Application::StringBase do
expect { app.preinit }.
should raise_error ArgumentError, /Unknown option "--bar"/
end
+
+ { "boolean options before" => %w{--trace foo},
+ "boolean options after" => %w{foo --trace}
+ }.each do |name, args|
+ it "should accept global boolean settings #{name} the action" do
+ app.command_line.stubs(:args).returns args
+ app.preinit && app.parse_options
+ Puppet[:trace].should be_true
+ end
+ end
+
+ { "before" => %w{--syslogfacility user1 foo},
+ " after" => %w{foo --syslogfacility user1}
+ }.each do |name, args|
+ it "should accept global settings with arguments #{name} the action" do
+ app.command_line.stubs(:args).returns args
+ app.preinit && app.parse_options
+ Puppet[:syslogfacility].should == "user1"
+ end
+ end
end
end