diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-07-07 00:57:01 -0700 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-07-07 00:57:01 -0700 |
commit | c55df9301c34ae9778c6a7ffadaeeb3247017cde (patch) | |
tree | 08193c274233fd031e3417b543c88ef4a2305a2d /railties | |
parent | b3da67d9a5dfbc2b39b77e5b2f0874137f8716ef (diff) | |
parent | 8fe9b43b3016f2c0e7afad8fc081bbf37f267226 (diff) | |
download | rails-c55df9301c34ae9778c6a7ffadaeeb3247017cde.tar.gz rails-c55df9301c34ae9778c6a7ffadaeeb3247017cde.tar.bz2 rails-c55df9301c34ae9778c6a7ffadaeeb3247017cde.zip |
Merge pull request #6993 from morgoth/engine-table-name-prefix-generator-fix
Engine table name prefix generator fix
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/generators/namespaced_generators_test.rb | 2 | ||||
-rw-r--r-- | railties/test/railties/generators_test.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/railties/test/generators/namespaced_generators_test.rb b/railties/test/generators/namespaced_generators_test.rb index 2ae9dc61a7..db2b8af217 100644 --- a/railties/test/generators/namespaced_generators_test.rb +++ b/railties/test/generators/namespaced_generators_test.rb @@ -99,7 +99,7 @@ class NamespacedModelGeneratorTest < NamespacedGeneratorTestCase run_generator ["admin/account"] assert_file "app/models/test_app/admin.rb", /module TestApp/, /module Admin/ assert_file "app/models/test_app/admin.rb", /def self\.table_name_prefix/ - assert_file "app/models/test_app/admin.rb", /'admin_'/ + assert_file "app/models/test_app/admin.rb", /'test_app_admin_'/ assert_file "app/models/test_app/admin/account.rb", /module TestApp/, /class Admin::Account < ActiveRecord::Base/ end diff --git a/railties/test/railties/generators_test.rb b/railties/test/railties/generators_test.rb index 1938bfb6c2..c90b795d59 100644 --- a/railties/test/railties/generators_test.rb +++ b/railties/test/railties/generators_test.rb @@ -75,6 +75,18 @@ module RailtiesTests end end + def test_table_name_prefix_is_correctly_namespaced_when_engine_is_mountable + build_mountable_engine + Dir.chdir(engine_path) do + bundled_rails("g model namespaced/topic") + assert_file "app/models/foo_bar/namespaced.rb", /module FooBar\n module Namespaced/ do |content| + assert_class_method :table_name_prefix, content do |method_content| + assert_match(/'foo_bar_namespaced_'/, method_content) + end + end + end + end + def test_helpers_are_correctly_namespaced_when_engine_is_mountable build_mountable_engine Dir.chdir(engine_path) do |