diff options
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 7 | ||||
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 9 |
2 files changed, 10 insertions, 6 deletions
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 832bf8d2d4..199743a396 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -222,17 +222,12 @@ class MigrationGeneratorTest < Rails::Generators::TestCase end def test_add_uuid_to_create_table_migration - previous_value = Rails.application.config.generators.active_record[:primary_key_type] - Rails.application.config.generators.active_record[:primary_key_type] = :uuid - - run_generator ["create_books"] + run_generator ["create_books", "--primary_key_type=uuid"] 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.generators.active_record[:primary_key_type] = previous_value end def test_should_create_empty_migrations_if_name_not_start_with_add_or_remove_or_create diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index abd3ff50a4..64b9a480f3 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -374,6 +374,15 @@ class ModelGeneratorTest < Rails::Generators::TestCase end end + def test_add_uuid_to_create_table_migration + run_generator ["account", "--primary_key_type=uuid"] + assert_migration "db/migrate/create_accounts.rb" do |content| + assert_method :change, content do |change| + assert_match(/create_table :accounts, id: :uuid/, change) + end + end + end + def test_required_belongs_to_adds_required_association run_generator ["account", "supplier:references{required}"] |