aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-06-12 16:19:51 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-06-12 16:19:51 -0700
commit56a1bb2f1066d0c119834019916f1e4b05fffec0 (patch)
tree5fa6e1a833c2327aff83eb9c5103024c2c377a32 /activesupport/test
parent00d8ee8e303be3b2036a68408b8d6eba3cab5612 (diff)
downloadrails-56a1bb2f1066d0c119834019916f1e4b05fffec0.tar.gz
rails-56a1bb2f1066d0c119834019916f1e4b05fffec0.tar.bz2
rails-56a1bb2f1066d0c119834019916f1e4b05fffec0.zip
raise the same exception in order to keep path info
Ruby 2.0.0 implements LoadError#path, but newly raised load errors will not contain the path information. Replace the error message, copy blame, and rereaise the same exception object
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/dependencies_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index f622c6b43f..69829bcda5 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -39,6 +39,19 @@ class DependenciesTest < ActiveSupport::TestCase
with_loading 'autoloading_fixtures', &block
end
+ def test_depend_on_path
+ skip "LoadError#path does not exist" if RUBY_VERSION < '2.0.0'
+
+ expected = assert_raises(LoadError) do
+ Kernel.require 'omgwtfbbq'
+ end
+
+ e = assert_raises(LoadError) do
+ ActiveSupport::Dependencies.depend_on 'omgwtfbbq'
+ end
+ assert_equal expected.path, e.path
+ end
+
def test_tracking_loaded_files
require_dependency 'dependencies/service_one'
require_dependency 'dependencies/service_two'