summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/application')
-rwxr-xr-xspec/unit/application/apply.rb4
-rw-r--r--spec/unit/application/cert.rb10
-rwxr-xr-xspec/unit/application/doc.rb6
-rw-r--r--spec/unit/application/filebucket.rb2
-rwxr-xr-xspec/unit/application/resource.rb13
5 files changed, 18 insertions, 17 deletions
diff --git a/spec/unit/application/apply.rb b/spec/unit/application/apply.rb
index 10202e196..a1a7e7b31 100755
--- a/spec/unit/application/apply.rb
+++ b/spec/unit/application/apply.rb
@@ -204,7 +204,7 @@ describe Puppet::Application::Apply do
end
it "should set the code to run from STDIN if no arguments" do
- Puppet::Util::CommandLine.stubs(:args).returns([])
+ @apply.command_line.stubs(:args).returns([])
STDIN.stubs(:read).returns("code to run")
Puppet.expects(:[]=).with(:code,"code to run")
@@ -213,7 +213,7 @@ describe Puppet::Application::Apply do
end
it "should set the manifest if some files are passed on command line" do
- Puppet::Util::CommandLine.stubs(:args).returns(['site.pp'])
+ @apply.command_line.stubs(:args).returns(['site.pp'])
Puppet.expects(:[]=).with(:manifest,"site.pp")
diff --git a/spec/unit/application/cert.rb b/spec/unit/application/cert.rb
index 3fb2f1ed4..5970355e8 100644
--- a/spec/unit/application/cert.rb
+++ b/spec/unit/application/cert.rb
@@ -110,7 +110,7 @@ describe Puppet::Application::Cert do
@cert_app.all = false
@ca = stub_everything 'ca'
@cert_app.ca = @ca
- Puppet::Util::CommandLine.stubs(:args).returns([])
+ @cert_app.command_line.stubs(:args).returns([])
end
it "should delegate to the CertificateAuthority" do
@@ -128,7 +128,7 @@ describe Puppet::Application::Cert do
end
it "should delegate to ca.apply with the hosts given on command line" do
- Puppet::Util::CommandLine.stubs(:args).returns(["host"])
+ @cert_app.command_line.stubs(:args).returns(["host"])
@ca.expects(:apply).with { |mode,to| to[:to] == ["host"]}
@@ -136,7 +136,7 @@ describe Puppet::Application::Cert do
end
it "should send the currently set digest" do
- Puppet::Util::CommandLine.stubs(:args).returns(["host"])
+ @cert_app.command_line.stubs(:args).returns(["host"])
@cert_app.handle_digest(:digest)
@ca.expects(:apply).with { |mode,to| to[:digest] == :digest}
@@ -146,7 +146,7 @@ describe Puppet::Application::Cert do
it "should delegate to ca.apply with current set mode" do
@cert_app.mode = "currentmode"
- Puppet::Util::CommandLine.stubs(:args).returns(["host"])
+ @cert_app.command_line.stubs(:args).returns(["host"])
@ca.expects(:apply).with { |mode,to| mode == "currentmode" }
@@ -155,7 +155,7 @@ describe Puppet::Application::Cert do
it "should revoke cert if mode is clean" do
@cert_app.mode = :destroy
- Puppet::Util::CommandLine.stubs(:args).returns(["host"])
+ @cert_app.command_line.stubs(:args).returns(["host"])
@ca.expects(:apply).with { |mode,to| mode == :revoke }
@ca.expects(:apply).with { |mode,to| mode == :destroy }
diff --git a/spec/unit/application/doc.rb b/spec/unit/application/doc.rb
index 3bda25f2f..c1184925e 100755
--- a/spec/unit/application/doc.rb
+++ b/spec/unit/application/doc.rb
@@ -128,11 +128,11 @@ describe Puppet::Application::Doc do
before :each do
Puppet::Log.stubs(:newdestination)
- Puppet::Util::CommandLine.stubs(:args).returns([])
+ @doc.command_line.stubs(:args).returns([])
end
it "should default to rdoc mode if there are command line arguments" do
- Puppet::Util::CommandLine.stubs(:args).returns(["1"])
+ @doc.command_line.stubs(:args).returns(["1"])
@doc.stubs(:setup_rdoc)
@doc.options.expects(:[]=).with(:mode,:rdoc)
@@ -304,7 +304,7 @@ describe Puppet::Application::Doc do
@doc.stubs(:exit)
File.stubs(:expand_path).with('modules').returns('modules')
File.stubs(:expand_path).with('manifests').returns('manifests')
- Puppet::Util::CommandLine.stubs(:args).returns([])
+ @doc.command_line.stubs(:args).returns([])
end
it "should set document_all on --all" do
diff --git a/spec/unit/application/filebucket.rb b/spec/unit/application/filebucket.rb
index 68af45c40..58c7f7c75 100644
--- a/spec/unit/application/filebucket.rb
+++ b/spec/unit/application/filebucket.rb
@@ -152,7 +152,7 @@ describe Puppet::Application::Filebucket do
end
it "should use the first non-option parameter as the dispatch" do
- Puppet::Util::CommandLine.stubs(:args).returns([:get])
+ @filebucket.command_line.stubs(:args).returns(['get'])
@filebucket.expects(:get)
diff --git a/spec/unit/application/resource.rb b/spec/unit/application/resource.rb
index 2e90cc288..3487b2c3c 100755
--- a/spec/unit/application/resource.rb
+++ b/spec/unit/application/resource.rb
@@ -135,12 +135,12 @@ describe Puppet::Application::Resource do
before :each do
@type = stub_everything 'type', :properties => []
- Puppet::Util::CommandLine.stubs(:args).returns(['type'])
+ @resource.command_line.stubs(:args).returns(['type'])
Puppet::Type.stubs(:type).returns(@type)
end
it "should raise an error if no type is given" do
- Puppet::Util::CommandLine.stubs(:args).returns([])
+ @resource.command_line.stubs(:args).returns([])
lambda { @resource.main }.should raise_error
end
@@ -168,19 +168,20 @@ describe Puppet::Application::Resource do
end
it "should search for resources" do
+ @resource.command_line.stubs(:args).returns(['type'])
Puppet::Resource.expects(:search).with('https://host:8139/production/resources/type/', {}).returns([])
@resource.main
end
it "should describe the given resource" do
- Puppet::Util::CommandLine.stubs(:args).returns(['type', 'name'])
+ @resource.command_line.stubs(:args).returns(['type', 'name'])
x = stub_everything 'resource'
Puppet::Resource.expects(:find).with('https://host:8139/production/resources/type/name').returns(x)
@resource.main
end
it "should add given parameters to the object" do
- Puppet::Util::CommandLine.stubs(:args).returns(['type','name','param=temp'])
+ @resource.command_line.stubs(:args).returns(['type','name','param=temp'])
res = stub "resource"
res.expects(:save).with('https://host:8139/production/resources/type/name').returns(res)
@@ -209,14 +210,14 @@ describe Puppet::Application::Resource do
end
it "should describe the given resource" do
- Puppet::Util::CommandLine.stubs(:args).returns(['type','name'])
+ @resource.command_line.stubs(:args).returns(['type','name'])
x = stub_everything 'resource'
Puppet::Resource.expects(:find).with('type/name').returns(x)
@resource.main
end
it "should add given parameters to the object" do
- Puppet::Util::CommandLine.stubs(:args).returns(['type','name','param=temp'])
+ @resource.command_line.stubs(:args).returns(['type','name','param=temp'])
res = stub "resource"
res.expects(:save).with('type/name').returns(res)