Skip to content
This repository
Browse code

Test return value of ActiveSupport::Dependencies::Loadable#load

  • Loading branch information...
commit 9effced47fff7cf78734bba64bc95735db29ba0a 1 parent dea2e9c
Sam Umbach authored December 03, 2011

Showing 1 changed file with 16 additions and 0 deletions. Show diff stats Hide diff stats

  1. 16  activesupport/test/dependencies_test.rb
16  activesupport/test/dependencies_test.rb
@@ -306,6 +306,22 @@ def test_require_returns_false_when_file_already_required
306 306
     $:.replace(original_path)
307 307
   end
308 308
 
  309
+  def test_load_returns_true_when_file_found
  310
+    path = File.expand_path("../autoloading_fixtures/load_path", __FILE__)
  311
+    original_path = $:.dup
  312
+    original_features = $".dup
  313
+    $:.push(path)
  314
+
  315
+    with_loading('autoloading_fixtures/load_path') do
  316
+      assert_equal true, load('loaded_constant.rb')
  317
+      assert_equal true, load('loaded_constant.rb')
  318
+    end
  319
+  ensure
  320
+    remove_constants(:LoadedConstant)
  321
+    $".replace(original_features)
  322
+    $:.replace(original_path)
  323
+  end
  324
+
309 325
   def failing_test_access_thru_and_upwards_fails
310 326
     with_autoloading_fixtures do
311 327
       assert ! defined?(ModuleFolder)

0 notes on commit 9effced

Please sign in to comment.
Something went wrong with that request. Please try again.