aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-09-27 11:26:49 -0400
committerGitHub <noreply@github.com>2018-09-27 11:26:49 -0400
commit8a0194f1514fc2374b18db909f78f733ba0857b9 (patch)
tree7e644c6581425760f859a49bf207e13ed56677a3 /railties/test
parent1930d22936c3bfb883dd4b46173bb902db17bb50 (diff)
parent77aaeced89cb84404cf69f8b23834520de3214a9 (diff)
downloadrails-8a0194f1514fc2374b18db909f78f733ba0857b9.tar.gz
rails-8a0194f1514fc2374b18db909f78f733ba0857b9.tar.bz2
rails-8a0194f1514fc2374b18db909f78f733ba0857b9.zip
Merge pull request #33994 from gmcgibbon/rails_g_model_migrations_paths
Add migrations_paths option to model generator
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/model_generator_test.rb9
-rw-r--r--railties/test/generators/scaffold_generator_test.rb6
2 files changed, 15 insertions, 0 deletions
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"]