diff options
author | Paul Nikitochkin <paul.nikitochkin@gmail.com> | 2013-11-11 19:56:02 +0200 |
---|---|---|
committer | Paul Nikitochkin <paul.nikitochkin@gmail.com> | 2013-11-16 21:47:08 +0200 |
commit | 251923c7a85a303d74b41255c39d8928ffa109ea (patch) | |
tree | da3afd05f6f68737c914dcccd4486e3cd2524004 /railties/test/application | |
parent | 93e752cfae4564eff9827de7ee16a24b1f832c91 (diff) | |
download | rails-251923c7a85a303d74b41255c39d8928ffa109ea.tar.gz rails-251923c7a85a303d74b41255c39d8928ffa109ea.tar.bz2 rails-251923c7a85a303d74b41255c39d8928ffa109ea.zip |
Instrument each load config initializer
In order to simplify profiling loading of initializers,
added instument for tracking load config initializer event from
`config/initializers`
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/initializers/notifications_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/test/application/initializers/notifications_test.rb b/railties/test/application/initializers/notifications_test.rb index baae6fd928..0c10726b6f 100644 --- a/railties/test/application/initializers/notifications_test.rb +++ b/railties/test/application/initializers/notifications_test.rb @@ -39,5 +39,18 @@ module ApplicationTests assert_equal 1, logger.logged(:debug).size assert_match(/SHOW tables/, logger.logged(:debug).last) end + + test 'rails load_config_initializer event is instrumented' do + app_file 'config/initializers/foo.rb', '' + + events = [] + callback = -> (*_) { events << _ } + ActiveSupport::Notifications.subscribed(callback, 'load_config_initializer.railties') do + app + end + + assert_equal %w[load_config_initializer.railties], events.map(&:first) + assert_includes events.first.last[:initializer], 'config/initializers/foo.rb' + end end end |