diff options
Diffstat (limited to 'railties/test/generators/migration_generator_test.rb')
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 57bc220558..a7f807b747 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -221,6 +221,19 @@ class MigrationGeneratorTest < Rails::Generators::TestCase end end + def test_add_uuid_to_create_table_migration + previous_value = Rails.application.config.active_record.primary_key + Rails.application.config.active_record.primary_key = :uuid + run_generator ["create_books"] + assert_migration "db/migrate/create_books.rb" do |content| + assert_method :change, content do |change| + assert_match(/create_table :books, id: :uuid/, change) + end + end + + Rails.application.config.active_record.primary_key = previous_value + end + def test_should_create_empty_migrations_if_name_not_start_with_add_or_remove_or_create migration = "delete_books" run_generator [migration, "title:string", "content:text"] |