From 77aaeced89cb84404cf69f8b23834520de3214a9 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Wed, 26 Sep 2018 17:16:54 -0400 Subject: Add migrations_paths option to model generator --- railties/test/generators/model_generator_test.rb | 9 +++++++++ railties/test/generators/scaffold_generator_test.rb | 6 ++++++ 2 files changed, 15 insertions(+) (limited to 'railties/test/generators') diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 7febdfae96..5a0c2f74c7 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -392,6 +392,15 @@ class ModelGeneratorTest < Rails::Generators::TestCase end end + def test_migrations_paths_puts_migrations_in_that_folder + run_generator ["account", "--migrations_paths=db/test_migrate"] + assert_migration "db/test_migrate/create_accounts.rb" do |content| + assert_method :change, content do |change| + assert_match(/create_table :accounts/, change) + end + end + end + def test_required_belongs_to_adds_required_association run_generator ["account", "supplier:references{required}"] diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index e90834bc2b..dbcf49290e 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -476,6 +476,12 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase end end + def test_scaffold_generator_migrations_paths + run_generator ["posts", "--migrations-paths=db/kingston_migrate"] + + assert_migration "db/kingston_migrate/create_posts.rb" + end + def test_scaffold_generator_password_digest run_generator ["user", "name", "password:digest"] -- cgit v1.2.3