aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorSam Umbach <sam@thinkrelevance.com>2011-12-03 13:08:18 -0500
committerSam Umbach <sam@thinkrelevance.com>2011-12-03 13:08:18 -0500
commit2a9f0630822f60adfb418c34ec9cea30a2a716ed (patch)
tree03a8bc125921866480587523335397c36ca41479 /activesupport/test
parent0a485309a03bdf290d3c42186916dac5e900db65 (diff)
downloadrails-2a9f0630822f60adfb418c34ec9cea30a2a716ed.tar.gz
rails-2a9f0630822f60adfb418c34ec9cea30a2a716ed.tar.bz2
rails-2a9f0630822f60adfb418c34ec9cea30a2a716ed.zip
Test that require and load raise LoadError if file not found
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/dependencies_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index 94e7e118ff..3a7922d219 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -305,6 +305,14 @@ class DependenciesTest < Test::Unit::TestCase
$:.replace(original_path)
end
+ def test_require_raises_load_error_when_file_not_found
+ with_loading do
+ assert_raise(LoadError) { require 'this_file_dont_exist_dude' }
+ end
+ ensure
+ remove_constants(:LoadedConstant)
+ end
+
def test_load_returns_true_when_file_found
path = File.expand_path("../autoloading_fixtures/load_path", __FILE__)
original_path = $:.dup
@@ -321,6 +329,14 @@ class DependenciesTest < Test::Unit::TestCase
$:.replace(original_path)
end
+ def test_load_raises_load_error_when_file_not_found
+ with_loading do
+ assert_raise(LoadError) { load 'this_file_dont_exist_dude.rb' }
+ end
+ ensure
+ remove_constants(:LoadedConstant)
+ end
+
def failing_test_access_thru_and_upwards_fails
with_autoloading_fixtures do
assert ! defined?(ModuleFolder)