File tree Expand file tree Collapse file tree 2 files changed +40
-4
lines changed Expand file tree Collapse file tree 2 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ class << self
146
146
delegate :config , to : :instance
147
147
148
148
def subclasses
149
- super . reject ( &:abstract_railtie? )
149
+ super . reject ( &:abstract_railtie? ) . sort
150
150
end
151
151
152
152
def rake_tasks ( &blk )
@@ -191,6 +191,23 @@ def configure(&block)
191
191
instance . configure ( &block )
192
192
end
193
193
194
+ def <=>( other ) # :nodoc:
195
+ load_index <=> other . load_index
196
+ end
197
+
198
+ def inherited ( subclass )
199
+ subclass . increment_load_index
200
+ super
201
+ end
202
+
203
+ protected
204
+ attr_reader :load_index
205
+
206
+ def increment_load_index
207
+ @@load_counter ||= 0
208
+ @load_index = ( @@load_counter += 1 )
209
+ end
210
+
194
211
private
195
212
def generate_railtie_name ( string )
196
213
ActiveSupport ::Inflector . underscore ( string ) . tr ( "/" , "_" )
Original file line number Diff line number Diff line change @@ -1312,9 +1312,28 @@ def bar
1312
1312
get ( "/assets/bar.js" )
1313
1313
assert_match "// App's bar js" , last_response . body . strip
1314
1314
1315
- # ensure that railties are not added twice
1316
- railties = Rails . application . send ( :ordered_railties ) . map ( &:class )
1317
- assert_equal railties , railties . uniq
1315
+ assert_equal <<~EXPECTED , Rails . application . send ( :ordered_railties ) . flatten . map ( &:class ) . map ( &:name ) . join ( "\n " ) << "\n "
1316
+ I18n::Railtie
1317
+ ActiveSupport::Railtie
1318
+ ActionDispatch::Railtie
1319
+ ActiveModel::Railtie
1320
+ ActionController::Railtie
1321
+ ActiveRecord::Railtie
1322
+ GlobalID::Railtie
1323
+ ActiveJob::Railtie
1324
+ ActionMailer::Railtie
1325
+ Rails::TestUnitRailtie
1326
+ Sprockets::Railtie
1327
+ ActionView::Railtie
1328
+ ActiveStorage::Engine
1329
+ ActionCable::Engine
1330
+ ActionMailbox::Engine
1331
+ ActionText::Engine
1332
+ Bukkits::Engine
1333
+ Importmap::Engine
1334
+ AppTemplate::Application
1335
+ Blog::Engine
1336
+ EXPECTED
1318
1337
end
1319
1338
1320
1339
test "railties_order adds :all with lowest priority if not given" do
You can’t perform that action at this time.
0 commit comments