summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-08-27 12:33:15 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-08-27 12:33:15 -0700
commitfb9034731ddae41f1009745eb8eb1ea53aa05cfb (patch)
tree5cb8296af8859f59b9a20995105af77a9cdb2821 /spec/unit/application
parent16f701edd89a320ad73b5468d883dfb017fe6e96 (diff)
parent8be1929043f4560bb17a4b06293b3f9a4efcfdbf (diff)
downloadpuppet-fb9034731ddae41f1009745eb8eb1ea53aa05cfb.tar.gz
puppet-fb9034731ddae41f1009745eb8eb1ea53aa05cfb.tar.xz
puppet-fb9034731ddae41f1009745eb8eb1ea53aa05cfb.zip
Merge commit '2.6.1rc3' into next
Diffstat (limited to 'spec/unit/application')
-rwxr-xr-xspec/unit/application/apply_spec.rb24
-rwxr-xr-xspec/unit/application/doc_spec.rb19
2 files changed, 21 insertions, 22 deletions
diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb
index a79ddbad3..b073d1a6f 100755
--- a/spec/unit/application/apply_spec.rb
+++ b/spec/unit/application/apply_spec.rb
@@ -3,6 +3,7 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require 'puppet/application/apply'
+require 'puppet/file_bucket/dipper'
describe Puppet::Application::Apply do
before :each do
@@ -53,7 +54,6 @@ describe Puppet::Application::Apply do
Puppet.stubs(:trap)
Puppet::Log.stubs(:level=)
Puppet.stubs(:parse_config)
- require 'lib/puppet/file_bucket/dipper'
Puppet::FileBucket::Dipper.stubs(:new)
STDIN.stubs(:read)
@@ -211,7 +211,8 @@ describe Puppet::Application::Apply do
@apply.main
end
- it "should set the manifest if some files are passed on command line" do
+ it "should set the manifest if a file is passed on command line and the file exists" do
+ File.stubs(:exist?).with('site.pp').returns true
@apply.command_line.stubs(:args).returns(['site.pp'])
Puppet.expects(:[]=).with(:manifest,"site.pp")
@@ -219,6 +220,23 @@ describe Puppet::Application::Apply do
@apply.main
end
+ it "should raise an error if a file is passed on command line and the file does not exist" do
+ File.stubs(:exist?).with('noexist.pp').returns false
+ @apply.command_line.stubs(:args).returns(['noexist.pp'])
+ lambda { @apply.main }.should raise_error(RuntimeError, 'Could not find file noexist.pp')
+ end
+
+ it "should set the manifest to the first file and warn other files will be skipped" do
+ File.stubs(:exist?).with('starwarsIV').returns true
+ File.expects(:exist?).with('starwarsI').never
+ @apply.command_line.stubs(:args).returns(['starwarsIV', 'starwarsI', 'starwarsII'])
+
+ Puppet.expects(:[]=).with(:manifest,"starwarsIV")
+ Puppet.expects(:warning).with('Only one file can be applied per run. Skipping starwarsI, starwarsII')
+
+ @apply.main
+ end
+
it "should collect the node facts" do
Puppet::Node::Facts.expects(:find).returns(@facts)
@@ -231,7 +249,7 @@ describe Puppet::Application::Apply do
lambda { @apply.main }.should raise_error
end
- it "should find the node" do
+ it "should look for the node" do
Puppet::Node.expects(:find).returns(@node)
@apply.main
diff --git a/spec/unit/application/doc_spec.rb b/spec/unit/application/doc_spec.rb
index 7a22f5b2e..55da5e39a 100755
--- a/spec/unit/application/doc_spec.rb
+++ b/spec/unit/application/doc_spec.rb
@@ -27,10 +27,6 @@ describe Puppet::Application::Doc do
@doc.should respond_to(:rdoc)
end
- it "should declare a trac command" do
- @doc.should respond_to(:trac)
- end
-
it "should declare a fallback for unknown options" do
@doc.should respond_to(:handle_unknown)
end
@@ -270,21 +266,6 @@ describe Puppet::Application::Doc do
end
describe "when running" do
- before :each do
- end
-
- describe "in trac mode" do
- it "should call trac for each reference" do
- ref = stub 'ref'
- Puppet::Util::Reference.stubs(:reference).with(:ref).returns(ref)
- @doc.options.stubs(:[]).with(:references).returns([:ref])
- @doc.options.stubs(:[]).with(:mode).returns(:trac)
-
- ref.expects(:trac)
-
- @doc.trac
- end
- end
describe "in rdoc mode" do
before :each do