summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-01-06 15:56:31 -0800
committerNick Lewis <nick@puppetlabs.com>2011-01-06 15:56:31 -0800
commitf663182c28c9d4533ad4c2f897e5fbbf78b16d8e (patch)
tree28da3fd7c329de073e71b5b1ba1be01ec4e54b6f /spec/unit/application
parentc7764723578ae64240db7bd2a64f8e6e9fa708ab (diff)
parentb16e10dba6606b808ef195f4b57f2e8c66cf65ab (diff)
Merge branch 'intermediate_merge_branch' into next
Diffstat (limited to 'spec/unit/application')
-rwxr-xr-xspec/unit/application/apply_spec.rb4
-rw-r--r--spec/unit/application/inspect_spec.rb25
-rwxr-xr-xspec/unit/application/kick_spec.rb4
-rw-r--r--spec/unit/application/master_spec.rb4
4 files changed, 28 insertions, 9 deletions
diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb
index 6451195fc..9485ed221 100755
--- a/spec/unit/application/apply_spec.rb
+++ b/spec/unit/application/apply_spec.rb
@@ -325,8 +325,8 @@ describe Puppet::Application::Apply do
it "should save the last run summary" do
Puppet.stubs(:[]).with(:noop).returns(false)
- report = stub 'report'
- Puppet::Configurer.any_instance.stubs(:initialize_report).returns(report)
+ report = Puppet::Transaction::Report.new("apply")
+ Puppet::Transaction::Report.stubs(:new).returns(report)
Puppet::Configurer.any_instance.expects(:save_last_run_summary).with(report)
@apply.main
diff --git a/spec/unit/application/inspect_spec.rb b/spec/unit/application/inspect_spec.rb
index a3cc74d86..b931708c3 100644
--- a/spec/unit/application/inspect_spec.rb
+++ b/spec/unit/application/inspect_spec.rb
@@ -51,7 +51,7 @@ describe Puppet::Application::Inspect do
catalog = Puppet::Resource::Catalog.new
file = Tempfile.new("foo")
file.puts("file contents")
- file.flush
+ file.close
resource = Puppet::Resource.new(:file, file.path, :parameters => {:audit => "all"})
catalog.add_resource(resource)
Puppet::Resource::Catalog::Yaml.any_instance.stubs(:find).returns(catalog)
@@ -69,6 +69,29 @@ describe Puppet::Application::Inspect do
end
properties["ensure"].should == :file
properties["content"].should == "{md5}#{Digest::MD5.hexdigest("file contents\n")}"
+ properties.has_key?("target").should == false
+ end
+
+ it "should not report irrelevent attributes if the resource is absent" do
+ catalog = Puppet::Resource::Catalog.new
+ file = Tempfile.new("foo")
+ resource = Puppet::Resource.new(:file, file.path, :parameters => {:audit => "all"})
+ file.delete
+ catalog.add_resource(resource)
+ Puppet::Resource::Catalog::Yaml.any_instance.stubs(:find).returns(catalog)
+
+ events = nil
+
+ Puppet::Transaction::Report::Rest.any_instance.expects(:save).with do |request|
+ events = request.instance.resource_statuses.values.first.events
+ end
+
+ @inspect.run_command
+
+ properties = events.inject({}) do |property_values, event|
+ property_values.merge(event.property => event.previous_value)
+ end
+ properties.should == {"ensure" => :absent}
end
end
diff --git a/spec/unit/application/kick_spec.rb b/spec/unit/application/kick_spec.rb
index 227874171..ce0e0c7d0 100755
--- a/spec/unit/application/kick_spec.rb
+++ b/spec/unit/application/kick_spec.rb
@@ -4,9 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require 'puppet/application/kick'
-describe Puppet::Application::Kick do
-
- confine "Kick's eventloops can only start on POSIX" => Puppet.features.posix?
+describe Puppet::Application::Kick, :if => Puppet.features.posix? do
before :each do
require 'puppet/util/ldap/connection'
diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb
index ea52b2f47..1cf06ffa6 100644
--- a/spec/unit/application/master_spec.rb
+++ b/spec/unit/application/master_spec.rb
@@ -429,9 +429,7 @@ describe Puppet::Application::Master do
@master.main
end
- describe "with --rack" do
- confine "Rack is not available" => Puppet.features.rack?
-
+ describe "with --rack", :if => Puppet.features.rack? do
before do
require 'puppet/network/http/rack'
Puppet::Network::HTTP::Rack.stubs(:new).returns(@app)