diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 9 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 13 |
3 files changed, 23 insertions, 5 deletions
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index a7f807b747..199743a396 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -222,16 +222,12 @@ class MigrationGeneratorTest < Rails::Generators::TestCase 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"] + 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.active_record.primary_key = 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}"] diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index a19a29056d..715debf344 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -440,6 +440,19 @@ class PluginGeneratorTest < Rails::Generators::TestCase end end + def test_unnecessary_files_are_not_generated_in_dummy_application + run_generator + assert_no_file 'test/dummy/.gitignore' + assert_no_file 'test/dummy/db/seeds.rb' + assert_no_file 'test/dummy/Gemfile' + assert_no_file 'test/dummy/public/robots.txt' + assert_no_file 'test/dummy/README.md' + assert_no_directory 'test/dummy/lib/tasks' + assert_no_directory 'test/dummy/doc' + assert_no_directory 'test/dummy/test' + assert_no_directory 'test/dummy/vendor' + end + def test_skipping_test_files run_generator [destination_root, "--skip-test"] assert_no_file "test" |