diff options
author | Alex Robbin <alex.robbin@meyouhealth.com> | 2014-12-26 12:29:53 -0500 |
---|---|---|
committer | Alex Robbin <alex.robbin@meyouhealth.com> | 2014-12-26 23:21:20 -0500 |
commit | 4e0ec961e1f81ef672e2728b8650e4358962962f (patch) | |
tree | 09c49243625eb8741ed795c662e879043b9e73d8 /railties/test | |
parent | aff03e71b4a9d5b0d9190c52ecded79f44e937ce (diff) | |
download | rails-4e0ec961e1f81ef672e2728b8650e4358962962f.tar.gz rails-4e0ec961e1f81ef672e2728b8650e4358962962f.tar.bz2 rails-4e0ec961e1f81ef672e2728b8650e4358962962f.zip |
actually autoload all second-level directories called `app/*/concerns`
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/loading_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb index 4f30f30f95..85066210f3 100644 --- a/railties/test/application/loading_test.rb +++ b/railties/test/application/loading_test.rb @@ -33,6 +33,35 @@ class LoadingTest < ActiveSupport::TestCase assert_equal 'omg', p.title end + test "concerns in app are autoloaded" do + app_file "app/controllers/concerns/trackable.rb", <<-CONCERN + module Trackable + end + CONCERN + + app_file "app/mailers/concerns/email_loggable.rb", <<-CONCERN + module EmailLoggable + end + CONCERN + + app_file "app/models/concerns/orderable.rb", <<-CONCERN + module Orderable + end + CONCERN + + app_file "app/validators/concerns/matchable.rb", <<-CONCERN + module Matchable + end + CONCERN + + require "#{rails_root}/config/environment" + + assert_nothing_raised(NameError) { Trackable } + assert_nothing_raised(NameError) { EmailLoggable } + assert_nothing_raised(NameError) { Orderable } + assert_nothing_raised(NameError) { Matchable } + end + test "models without table do not panic on scope definitions when loaded" do app_file "app/models/user.rb", <<-MODEL class User < ActiveRecord::Base |