aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/initializers/load_path_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/application/initializers/load_path_test.rb')
-rw-r--r--railties/test/application/initializers/load_path_test.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/railties/test/application/initializers/load_path_test.rb b/railties/test/application/initializers/load_path_test.rb
index 714b6114a2..b39b9ecaae 100644
--- a/railties/test/application/initializers/load_path_test.rb
+++ b/railties/test/application/initializers/load_path_test.rb
@@ -10,7 +10,6 @@ module ApplicationTests
FileUtils.rm_rf "#{app_path}/config/environments"
end
- # General
test "initializing an application adds the application paths to the load path" do
add_to_config <<-RUBY
config.root = "#{app_path}"
@@ -20,10 +19,24 @@ module ApplicationTests
assert $:.include?("#{app_path}/app/models")
end
+ test "initializing an application eager load any path under app" do
+ app_file "app/anything/foo.rb", <<-RUBY
+ module Foo; end
+ RUBY
+
+ add_to_config <<-RUBY
+ config.root = "#{app_path}"
+ RUBY
+
+ require "#{app_path}/config/environment"
+ assert Foo
+ end
+
test "eager loading loads parent classes before children" do
app_file "lib/zoo.rb", <<-ZOO
class Zoo ; include ReptileHouse ; end
ZOO
+
app_file "lib/zoo/reptile_house.rb", <<-ZOO
module Zoo::ReptileHouse ; end
ZOO
@@ -34,7 +47,6 @@ module ApplicationTests
RUBY
require "#{app_path}/config/environment"
-
assert Zoo
end