summaryrefslogtreecommitdiff
path: root/chef/spec/unit/runner_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'chef/spec/unit/runner_spec.rb')
-rw-r--r--chef/spec/unit/runner_spec.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/chef/spec/unit/runner_spec.rb b/chef/spec/unit/runner_spec.rb
index fca8af4542..c1400af22f 100644
--- a/chef/spec/unit/runner_spec.rb
+++ b/chef/spec/unit/runner_spec.rb
@@ -1,4 +1,4 @@
-#
+
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
@@ -55,7 +55,7 @@ describe Chef::Runner do
end
it "should pass each resource in the collection to a provider" do
- @collection.should_receive(:each).once
+ @collection.should_receive(:execute_each_resource).once
@runner.converge
end
@@ -129,6 +129,21 @@ describe Chef::Runner do
@runner.converge
end
+ it "should follow a chain of actions" do
+ Chef::Platform.should_receive(:find_provider_for_node).exactly(5).times.and_return(Chef::Provider::SnakeOil)
+ @collection << Chef::Resource::Cat.new("peanut", @collection)
+ @collection[1].notifies :buy, @collection[0], :immediately
+ @collection << Chef::Resource::Cat.new("snuffles", @collection)
+ @collection[2].notifies :purr, @collection[1], :immediately
+ @collection[2].updated = true
+ provider = Chef::Provider::SnakeOil.new(@node, @collection[0])
+ p1 = Chef::Provider::SnakeOil.new(@node, @collection[1])
+ p2 = Chef::Provider::SnakeOil.new(@node, @collection[2])
+ Chef::Provider::SnakeOil.should_receive(:new).exactly(5).times.and_return(provider, p1, p2, p1, provider)
+ provider.should_receive(:action_buy).once.and_return(true)
+ @runner.converge
+ end
+
it "should execute delayed actions on changed resources" do
Chef::Platform.should_receive(:find_provider_for_node).exactly(3).times.and_return(Chef::Provider::SnakeOil)
provider = Chef::Provider::SnakeOil.new(@node, @collection[0])
@@ -153,4 +168,4 @@ describe Chef::Runner do
@runner.converge
end
-end \ No newline at end of file
+end