aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/model_generator_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/generators/model_generator_test.rb')
-rw-r--r--railties/test/generators/model_generator_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index 2b9f3ed7f2..99490af3a9 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -220,6 +220,17 @@ class ModelGeneratorTest < Rails::Generators::TestCase
ActiveRecord::Base.timestamped_migrations = true
end
+ def test_migration_with_configured_path
+ old_paths = Rails.application.config.paths["db/migrate"]
+ Rails.application.config.paths.add "db/migrate", with: "db2/migrate"
+
+ run_generator
+
+ assert_migration "db2/migrate/create_accounts.rb", /class CreateAccounts < ActiveRecord::Migration\[[0-9.]+\]/
+ ensure
+ Rails.application.config.paths["db/migrate"] = old_paths
+ end
+
def test_model_with_references_attribute_generates_belongs_to_associations
run_generator ["product", "name:string", "supplier:references"]
assert_file "app/models/product.rb", /belongs_to :supplier/