aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2019-05-10 16:45:46 -0400
committerGannon McGibbon <gannon.mcgibbon@gmail.com>2019-05-10 16:45:46 -0400
commite84ee74854876be00c3d072182af4c936c7d303c (patch)
tree8f2f28cf1d3084d63de98fa6bac897294638a1a3 /railties
parent36d145ca457d7f663517ac4096d8fae3da2491a9 (diff)
parent93d2090011b5ccab504b8aeabf6a95b23193a689 (diff)
downloadrails-e84ee74854876be00c3d072182af4c936c7d303c.tar.gz
rails-e84ee74854876be00c3d072182af4c936c7d303c.tar.bz2
rails-e84ee74854876be00c3d072182af4c936c7d303c.zip
Merge branch 'migration-timestamp-fix'
Closes #28707.
Diffstat (limited to 'railties')
-rw-r--r--railties/test/generators/migration_generator_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb
index e6b614a935..65cde91436 100644
--- a/railties/test/generators/migration_generator_test.rb
+++ b/railties/test/generators/migration_generator_test.rb
@@ -270,6 +270,21 @@ class MigrationGeneratorTest < Rails::Generators::TestCase
end
end
+ def test_create_table_migration_with_timestamps
+ run_generator ["create_books", "title:string", "content:text"]
+ assert_migration "db/migrate/create_books.rb", /t.timestamps/
+ end
+
+ def test_create_table_timestamps_are_skipped
+ run_generator ["create_books", "title:string", "content:text", "--no-timestamps"]
+
+ assert_migration "db/migrate/create_books.rb" do |m|
+ assert_method :change, m do |change|
+ assert_no_match(/t.timestamps/, change)
+ end
+ end
+ end
+
def test_add_uuid_to_create_table_migration
run_generator ["create_books", "--primary_key_type=uuid"]
assert_migration "db/migrate/create_books.rb" do |content|