aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/autoloading_fixtures/counting_loader.rb5
-rw-r--r--activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb1
-rw-r--r--activesupport/test/dependencies_test.rb23
3 files changed, 18 insertions, 11 deletions
diff --git a/activesupport/test/autoloading_fixtures/counting_loader.rb b/activesupport/test/autoloading_fixtures/counting_loader.rb
new file mode 100644
index 0000000000..4225c4412c
--- /dev/null
+++ b/activesupport/test/autoloading_fixtures/counting_loader.rb
@@ -0,0 +1,5 @@
+$counting_loaded_times ||= 0
+$counting_loaded_times += 1
+
+module CountingLoader
+end
diff --git a/activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb b/activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb
new file mode 100644
index 0000000000..d12d02f3aa
--- /dev/null
+++ b/activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb
@@ -0,0 +1 @@
+ModuleWithCustomConstMissing::A::B = "10" \ No newline at end of file
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index b607093e8e..fe823a9e52 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -57,34 +57,35 @@ class DependenciesTest < Test::Unit::TestCase
old_warnings, Dependencies.warnings_on_first_load = Dependencies.warnings_on_first_load, true
filename = "#{File.dirname(__FILE__)}/dependencies/check_warnings"
+ expanded = File.expand_path(filename)
$check_warnings_load_count = 0
- assert !Dependencies.loaded.include?(filename)
- assert !Dependencies.history.include?(filename)
+ assert !Dependencies.loaded.include?(expanded)
+ assert !Dependencies.history.include?(expanded)
silence_warnings { require_dependency filename }
assert_equal 1, $check_warnings_load_count
assert_equal true, $checked_verbose, 'On first load warnings should be enabled.'
- assert Dependencies.loaded.include?(filename)
+ assert Dependencies.loaded.include?(expanded)
Dependencies.clear
- assert !Dependencies.loaded.include?(filename)
- assert Dependencies.history.include?(filename)
+ assert !Dependencies.loaded.include?(expanded)
+ assert Dependencies.history.include?(expanded)
silence_warnings { require_dependency filename }
assert_equal 2, $check_warnings_load_count
assert_equal nil, $checked_verbose, 'After first load warnings should be left alone.'
- assert Dependencies.loaded.include?(filename)
+ assert Dependencies.loaded.include?(expanded)
Dependencies.clear
- assert !Dependencies.loaded.include?(filename)
- assert Dependencies.history.include?(filename)
+ assert !Dependencies.loaded.include?(expanded)
+ assert Dependencies.history.include?(expanded)
enable_warnings { require_dependency filename }
assert_equal 3, $check_warnings_load_count
assert_equal true, $checked_verbose, 'After first load warnings should be left alone.'
- assert Dependencies.loaded.include?(filename)
+ assert Dependencies.loaded.include?(expanded)
end
end
@@ -302,9 +303,9 @@ class DependenciesTest < Test::Unit::TestCase
def test_const_missing_should_not_double_load
with_loading 'autoloading_fixtures' do
- require_dependency 'counting_loader'
+ require_dependency '././counting_loader'
assert_equal 1, $counting_loaded_times
- ModuleFolder
+ Dependencies.load_missing_constant Object, :CountingLoader
assert_equal 1, $counting_loaded_times
end
end