summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-23 00:20:57 -0500
committerLuke Kanies <luke@madstop.com>2007-10-23 00:20:57 -0500
commit1746751ddc0e5dd5c5d32abe2ddb4d8305d739fc (patch)
tree4e5d567ce4521909277c610bd77fb07befe54e61 /spec
parent09f9c3c52e94b5cdb33f26b464f01285a5ba8c62 (diff)
downloadpuppet-1746751ddc0e5dd5c5d32abe2ddb4d8305d739fc.tar.gz
puppet-1746751ddc0e5dd5c5d32abe2ddb4d8305d739fc.tar.xz
puppet-1746751ddc0e5dd5c5d32abe2ddb4d8305d739fc.zip
Adding post- hooks for :find and :search in the indirection class.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/indirector/indirection.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/indirector/indirection.rb b/spec/unit/indirector/indirection.rb
index c8e4cc6af..8987fef8a 100755
--- a/spec/unit/indirector/indirection.rb
+++ b/spec/unit/indirector/indirection.rb
@@ -66,6 +66,16 @@ describe Puppet::Indirector::Indirection, " when looking for a model instance" d
@terminus.expects(:find).with(@name).returns(nil)
proc { @indirection.find(@name) }.should_not raise_error
end
+
+ it "should pass the instance to the :post_find hook if there is one" do
+ class << @terminus
+ def post_find
+ end
+ end
+ @terminus.expects(:post_find).with(@instance)
+ @terminus.expects(:find).with(@name).returns(@instance)
+ @indirection.find(@name)
+ end
end
describe Puppet::Indirector::Indirection, " when removing a model instance" do
@@ -84,6 +94,16 @@ describe Puppet::Indirector::Indirection, " when searching for multiple model in
@terminus.expects(:search).with(@name).returns(@instance)
@indirection.search(@name).should == @instance
end
+
+ it "should pass the instances to the :post_search hook if there is one" do
+ class << @terminus
+ def post_search
+ end
+ end
+ @terminus.expects(:post_search).with(@instance)
+ @terminus.expects(:search).with(@name).returns(@instance)
+ @indirection.search(@name)
+ end
end
describe Puppet::Indirector::Indirection, " when storing a model instance" do