summaryrefslogtreecommitdiff
path: root/spec/unit/module_tool/uninstaller_spec.rb
diff options
context:
space:
mode:
authorStig Sandbeck Mathisen <ssm@debian.org>2012-01-26 11:22:40 +0100
committerStig Sandbeck Mathisen <ssm@debian.org>2012-01-26 11:22:40 +0100
commitc17b3ba16e7013f06416f10b8752ef783f048717 (patch)
tree790f13f167199b954007e17d1c55a8d1b0218775 /spec/unit/module_tool/uninstaller_spec.rb
parent32af6143486ceb24a93636445d1883f5fe2299d7 (diff)
downloadpuppet-upstream/2.7.10.tar.gz
Imported Upstream version 2.7.10upstream/2.7.10
Diffstat (limited to 'spec/unit/module_tool/uninstaller_spec.rb')
-rw-r--r--spec/unit/module_tool/uninstaller_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/unit/module_tool/uninstaller_spec.rb b/spec/unit/module_tool/uninstaller_spec.rb
new file mode 100644
index 000000000..abf2db0f8
--- /dev/null
+++ b/spec/unit/module_tool/uninstaller_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+require 'puppet/module_tool'
+require 'tmpdir'
+
+describe Puppet::Module::Tool::Applications::Uninstaller do
+ include PuppetSpec::Files
+
+ describe "instances" do
+ let(:tmp_module_path1) { tmpdir("uninstaller_module_path1") }
+ let(:tmp_module_path2) { tmpdir("uninstaller_module_path2") }
+ let(:options) do
+ { :target_directories => [ tmp_module_path1, tmp_module_path2 ] }
+ end
+
+ it "should return an empty list if the module is not installed" do
+ described_class.new('foo', options).run.should == []
+ end
+
+ it "should uninstall an installed module" do
+ foo_module_path = File.join(tmp_module_path1, 'foo')
+ Dir.mkdir(foo_module_path)
+ described_class.new('foo', options).run.should == [ foo_module_path ]
+ end
+
+ it "should only uninstall the requested module" do
+ foo_module_path = File.join(tmp_module_path1, 'foo')
+ bar_module_path = File.join(tmp_module_path1, 'bar')
+ Dir.mkdir(foo_module_path)
+ Dir.mkdir(bar_module_path)
+ described_class.new('foo', options).run.should == [ foo_module_path ]
+ end
+
+ it "should uninstall the module from all target directories" do
+ foo1_module_path = File.join(tmp_module_path1, 'foo')
+ foo2_module_path = File.join(tmp_module_path2, 'foo')
+ Dir.mkdir(foo1_module_path)
+ Dir.mkdir(foo2_module_path)
+ described_class.new('foo', options).run.should == [ foo1_module_path, foo2_module_path ]
+ end
+
+ #11803
+ it "should check for broken dependencies"
+ end
+end