post_deployment_migration_generator_spec.rb 806 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. require 'rails/generators/testing/behavior'
  4. require 'rails/generators/testing/assertions'
  5. require 'generators/post_deployment_migration/post_deployment_migration_generator'
  6. describe PostDeploymentMigrationGenerator, type: :generator do
  7. include Rails::Generators::Testing::Behavior
  8. include Rails::Generators::Testing::Assertions
  9. include FileUtils
  10. tests described_class
  11. destination Rails.root.join('tmp', 'generator-test')
  12. before { prepare_destination }
  13. after { rm_rf(destination_root) }
  14. describe 'the migration' do
  15. it 'generates expected file' do
  16. run_generator %w(Changes)
  17. assert_migration('db/post_migrate/changes.rb', /disable_ddl/)
  18. assert_migration('db/post_migrate/changes.rb', /change/)
  19. end
  20. end
  21. end