From 8c134b697d2c30128f51cd69e47808a051b96b72 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 12:46:15 -0800 Subject: maint: broken test not failing due to over-eager exception catching A test was not testing what it claimed, but the failure exception was getting swallowed by an unnecessarily broad rescue match. Paired-With: Nick Lewis --- lib/puppet/configurer/plugin_handler.rb | 4 +--- spec/unit/configurer/plugin_handler_spec.rb | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb index 539441e75..8192d4719 100644 --- a/lib/puppet/configurer/plugin_handler.rb +++ b/lib/puppet/configurer/plugin_handler.rb @@ -19,9 +19,7 @@ module Puppet::Configurer::PluginHandler begin Puppet.info "Loading downloaded plugin #{file}" load file - rescue SystemExit,NoMemoryError - raise - rescue Exception => detail + rescue StandardError, LoadError => detail Puppet.err "Could not load downloaded file #{file}: #{detail}" end end diff --git a/spec/unit/configurer/plugin_handler_spec.rb b/spec/unit/configurer/plugin_handler_spec.rb index 25d2d47af..1423ae4b5 100755 --- a/spec/unit/configurer/plugin_handler_spec.rb +++ b/spec/unit/configurer/plugin_handler_spec.rb @@ -80,7 +80,7 @@ describe Puppet::Configurer::PluginHandler do end it "should not try to load files that don't exist" do - FileTest.expects(:exist?).with("foo").returns true + FileTest.expects(:exist?).with("foo").returns false @pluginhandler.expects(:load).never @pluginhandler.load_plugin("foo") -- cgit