summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-01 11:29:40 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-02 15:51:05 -0700
commit0e834afaa191c0a314e730416e34f44b10efda96 (patch)
tree478bad4651750ef546d6812e1544e66a271a7098
parent505a48c0d316aad7ff26ae2c0ade294707ca081e (diff)
downloadpuppet-0e834afaa191c0a314e730416e34f44b10efda96.tar.gz
puppet-0e834afaa191c0a314e730416e34f44b10efda96.tar.xz
puppet-0e834afaa191c0a314e730416e34f44b10efda96.zip
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 <pieter@puppetlabs.com>
-rwxr-xr-xspec/unit/string/string_collection_spec.rb10
1 files changed, 7 insertions, 3 deletions
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'