aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/dependencies_test.rb
diff options
context:
space:
mode:
authorBenjamin Fleischer <github@benjaminfleischer.com>2013-09-30 15:20:28 -0500
committerBenjamin Fleischer <github@benjaminfleischer.com>2013-09-30 19:57:03 -0500
commit0b0beb71d648efb417207502e142289ee77aa723 (patch)
tree948270a32a97ad2fe10d8b59145c9253c87635f1 /activesupport/test/dependencies_test.rb
parent432ffdb0739426122e216e0f7199ebc16f15de7e (diff)
downloadrails-0b0beb71d648efb417207502e142289ee77aa723.tar.gz
rails-0b0beb71d648efb417207502e142289ee77aa723.tar.bz2
rails-0b0beb71d648efb417207502e142289ee77aa723.zip
require_dependency should allow Pathname-like objects, not just String
Diffstat (limited to 'activesupport/test/dependencies_test.rb')
-rw-r--r--activesupport/test/dependencies_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index 4b1426bb2e..b8cbbca601 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -35,6 +35,17 @@ class DependenciesTest < ActiveSupport::TestCase
assert_equal expected.path, e.path
end
+ def test_require_dependency_accepts_an_object_which_implements_to_path
+ o = Object.new
+ def o.to_path; 'dependencies/service_one'; end
+ assert_nothing_raised {
+ require_dependency o
+ }
+ assert defined?(ServiceOne)
+ ensure
+ remove_constants(:ServiceOne)
+ end
+
def test_tracking_loaded_files
require_dependency 'dependencies/service_one'
require_dependency 'dependencies/service_two'