Permalink
Browse files

Test that require and load raise LoadError if file not found

  • Loading branch information...
1 parent 9effced commit 0531e26daa01d619386bc8df9518a987a1295b87 @sumbach sumbach committed Dec 3, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 activesupport/test/dependencies_test.rb
View
16 activesupport/test/dependencies_test.rb
@@ -306,6 +306,14 @@ def test_require_returns_false_when_file_already_required
$:.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
@@ -322,6 +330,14 @@ def test_load_returns_true_when_file_found
$:.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)

0 comments on commit 0531e26

Please sign in to comment.