summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-07 23:54:58 -0500
committerLuke Kanies <luke@madstop.com>2008-04-08 11:33:50 -0500
commit941177a4902f4bfe7b8b3f528ce6648752f5409c (patch)
tree605d3c4647097cae12622bf1d862c0f33c683539 /spec
parentc6729d134b6b0479e091928ee68abb9008d0f71d (diff)
downloadpuppet-941177a4902f4bfe7b8b3f528ce6648752f5409c.tar.gz
puppet-941177a4902f4bfe7b8b3f528ce6648752f5409c.tar.xz
puppet-941177a4902f4bfe7b8b3f528ce6648752f5409c.zip
Changing how destroy works, just a bit -- it now accepts
the name of the instance to be destroyed, rather than the instance itself.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/indirector/file.rb20
-rwxr-xr-xspec/unit/indirector/memory.rb2
2 files changed, 9 insertions, 13 deletions
diff --git a/spec/unit/indirector/file.rb b/spec/unit/indirector/file.rb
index a2aa4502d..fa10743ef 100755
--- a/spec/unit/indirector/file.rb
+++ b/spec/unit/indirector/file.rb
@@ -121,38 +121,34 @@ describe Puppet::Indirector::File do
describe Puppet::Indirector::File, " when removing files" do
it "should provide a method to remove files at a specified path" do
- file = stub 'file', :path => @path, :name => @path
File.expects(:exist?).with(@path).returns(true)
File.expects(:unlink).with(@path)
- @searcher.destroy(file)
+ @searcher.destroy(@path)
end
it "should throw an exception if the file is not found" do
- file = stub 'file', :path => @path, :name => @path
File.expects(:exist?).with(@path).returns(false)
- proc { @searcher.destroy(file) }.should raise_error(Puppet::Error)
+ proc { @searcher.destroy(@path) }.should raise_error(Puppet::Error)
end
it "should fail intelligently if the file cannot be removed" do
- file = stub 'file', :path => @path, :name => @path
File.expects(:exist?).with(@path).returns(true)
File.expects(:unlink).with(@path).raises(ArgumentError)
- proc { @searcher.destroy(file) }.should raise_error(Puppet::Error)
+ proc { @searcher.destroy(@path) }.should raise_error(Puppet::Error)
end
it "should use the path() method to calculate the path if it exists" do
- @searcher.meta_def(:path) do |name|
- name.upcase
+ @searcher.meta_def(:path) do |thing|
+ thing.to_s.upcase
end
- file = stub 'file', :name => "/yay"
- File.expects(:exist?).with("/YAY").returns(true)
- File.expects(:unlink).with("/YAY")
+ File.expects(:exist?).with("/MY/FILE").returns(true)
+ File.expects(:unlink).with("/MY/FILE")
- @searcher.destroy(file)
+ @searcher.destroy(@path)
end
end
end
diff --git a/spec/unit/indirector/memory.rb b/spec/unit/indirector/memory.rb
index c0fca6bd9..2e9a7f8f3 100755
--- a/spec/unit/indirector/memory.rb
+++ b/spec/unit/indirector/memory.rb
@@ -22,7 +22,7 @@ describe "A Memory Terminus", :shared => true do
it "should be able to remove previously saved instances" do
@searcher.save(@instance)
- @searcher.destroy(@instance)
+ @searcher.destroy(@instance.name)
@searcher.find(@name).should be_nil
end