File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
test/application/initializers Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change
1
+ * Support for Pathnames in eager load paths.
2
+
3
+ * Mike Pack*
4
+
1
5
* Fixed missing line and shadow on service pages(404, 422, 500).
2
6
3
7
* Dmitry Korotkov*
Original file line number Diff line number Diff line change @@ -465,7 +465,7 @@ def load_generators(app=self)
465
465
# files inside eager_load paths.
466
466
def eager_load!
467
467
config . eager_load_paths . each do |load_path |
468
- matcher = /\A #{ Regexp . escape ( load_path ) } \/ (.*)\. rb\Z /
468
+ matcher = /\A #{ Regexp . escape ( load_path . to_s ) } \/ (.*)\. rb\Z /
469
469
Dir . glob ( "#{ load_path } /**/*.rb" ) . sort . each do |file |
470
470
require_dependency file . sub ( matcher , '\1' )
471
471
end
Original file line number Diff line number Diff line change @@ -71,6 +71,20 @@ module Zoo::ReptileHouse ; end
71
71
assert Zoo
72
72
end
73
73
74
+ test "eager loading accepts Pathnames" do
75
+ app_file "lib/foo.rb" , <<-RUBY
76
+ module Foo; end
77
+ RUBY
78
+
79
+ add_to_config <<-RUBY
80
+ config.eager_load = true
81
+ config.eager_load_paths << Pathname.new("#{ app_path } /lib")
82
+ RUBY
83
+
84
+ require "#{ app_path } /config/environment"
85
+ assert Foo
86
+ end
87
+
74
88
test "load environment with global" do
75
89
$initialize_test_set_from_env = nil
76
90
app_file "config/environments/development.rb" , <<-RUBY
You can’t perform that action at this time.
0 commit comments