From 0e834afaa191c0a314e730416e34f44b10efda96 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Fri, 1 Apr 2011 11:29:40 -0700 Subject: MAINT: fix up tests that depend on the LoadError message to work. We depend on require throwing about a specific file on disk, rather than just generically, to ensure that we don't consume load errors from existing files. This means our tests need to be updated to reflect that, by raising with appropriate text when they stub require. Reviewed-By: Pieter van de Bruggen --- spec/unit/string/string_collection_spec.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'spec/unit/string') diff --git a/spec/unit/string/string_collection_spec.rb b/spec/unit/string/string_collection_spec.rb index 63ddf7c5e..184299e3c 100755 --- a/spec/unit/string/string_collection_spec.rb +++ b/spec/unit/string/string_collection_spec.rb @@ -101,7 +101,8 @@ describe Puppet::String::StringCollection do end it "should require the string by version if the 'current' version isn't it" do - subject.expects(:require).with('puppet/string/bar').raises(LoadError) + subject.expects(:require).with('puppet/string/bar'). + raises(LoadError, 'no such file to load -- puppet/string/bar') subject.expects(:require).with do |file| @strings[:bar]['0.0.1'] = true file == 'bar@0.0.1/puppet/string/bar' @@ -115,7 +116,9 @@ describe Puppet::String::StringCollection do end it "should return false if there is a LoadError requiring the string" do - subject.stubs(:require).raises(LoadError) + subject.stubs(:require). + raises(LoadError, 'no such file to load -- puppet/string/bar').then. + raises(LoadError, 'no such file to load -- bar@0.0.1/puppet/string/bar') subject.string?("bar", '0.0.1').should == false end @@ -138,7 +141,8 @@ describe Puppet::String::StringCollection do end it "should not register the version loaded from `{name}@{version}` as `:current`" do - subject.expects(:require).with('puppet/string/huzzah').raises(LoadError) + subject.expects(:require).with('puppet/string/huzzah'). + raises(LoadError, 'no such file to load -- puppet/string/huzzah') subject.expects(:require).with do |file| @strings[:huzzah]['0.0.1'] = true file == 'huzzah@0.0.1/puppet/string/huzzah' -- cgit