aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-02-25 21:02:00 -0300
committerRafael França <rafaelmfranca@gmail.com>2016-02-25 21:02:00 -0300
commit1cc96c2e5fe08bc69bd768febbb5e3150343aa30 (patch)
treec8f13ca094921e5466542cc11e38f1ae16a31b3a /railties
parentfcec068bf913d74146703a02388608aa54d4f3a8 (diff)
parent9614f9317fef91ab74aa259f5e7dabb4c9a1d874 (diff)
downloadrails-1cc96c2e5fe08bc69bd768febbb5e3150343aa30.tar.gz
rails-1cc96c2e5fe08bc69bd768febbb5e3150343aa30.tar.bz2
rails-1cc96c2e5fe08bc69bd768febbb5e3150343aa30.zip
Merge pull request #23846 from y-yagi/correctly_check_ApplicationRecord_in_mountable_engine
correctly check `ApplicationRecord` is exist in moutable engine
Diffstat (limited to 'railties')
-rw-r--r--railties/test/generators/plugin_generator_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb
index d7d27e6b2e..cf3ed8405d 100644
--- a/railties/test/generators/plugin_generator_test.rb
+++ b/railties/test/generators/plugin_generator_test.rb
@@ -642,6 +642,20 @@ class PluginGeneratorTest < Rails::Generators::TestCase
assert_file "app/models/bukkits/article.rb", /class Article < ApplicationRecord/
end
+ def test_generate_application_record_when_does_not_exist_in_mountable_engine
+ run_generator [destination_root, '--mountable']
+ FileUtils.rm "#{destination_root}/app/models/bukkits/application_record.rb"
+ capture(:stdout) do
+ `#{destination_root}/bin/rails g model article`
+ end
+
+ assert_file "#{destination_root}/app/models/bukkits/application_record.rb" do |record|
+ assert_match(/module Bukkits/, record)
+ assert_match(/class ApplicationRecord < ActiveRecord::Base/, record)
+ assert_match(/self.abstract_class = true/, record)
+ end
+ end
+
def test_after_bundle_callback
path = 'http://example.org/rails_template'
template = %{ after_bundle { run 'echo ran after_bundle' } }