diff options
author | Xavier Noria <fxn@hashref.com> | 2019-02-23 14:37:20 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2019-02-23 14:37:20 -0800 |
commit | 39b2a6374b49dba43606b1a806899e49aa055a81 (patch) | |
tree | e5bb4b761f19e9cd37947a87b25ad2b0c7ec5b10 /railties/test/application | |
parent | 4d9ba8b50b0ff01d19ff786aa64c9da0fb31aa7e (diff) | |
download | rails-39b2a6374b49dba43606b1a806899e49aa055a81.tar.gz rails-39b2a6374b49dba43606b1a806899e49aa055a81.tar.bz2 rails-39b2a6374b49dba43606b1a806899e49aa055a81.zip |
Let Zeitwerk autoloaders inflect with Active Support
[Harry Brundage & Xavier Noria]
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/zeitwerk_integration_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/railties/test/application/zeitwerk_integration_test.rb b/railties/test/application/zeitwerk_integration_test.rb index 18e53f88b7..db6c7816c7 100644 --- a/railties/test/application/zeitwerk_integration_test.rb +++ b/railties/test/application/zeitwerk_integration_test.rb @@ -47,6 +47,24 @@ class ZeitwerkIntegrationTest < ActiveSupport::TestCase assert_equal 0, Rails.autoloaders.count end + test "autoloaders inflect with Active Support" do + app_file "config/initializers/inflections.rb", <<-RUBY + ActiveSupport::Inflector.inflections(:en) do |inflect| + inflect.acronym 'RESTful' + end + RUBY + + boot + + basename = "restful_controller" + abspath = "#{Rails.root}/app/controllers/#{basename}.rb" + camelized = "RESTfulController" + + Rails.autoloaders.each do |autoloader| + assert_equal camelized, autoloader.inflector.camelize(basename, abspath) + end + end + test "constantize returns the value stored in the constant" do app_file "app/models/admin/user.rb", "class Admin::User; end" boot |