2023-04-11 19:25:29 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
2023-10-24 04:58:29 +11:00
|
|
|
require 'rails/generators/testing/behavior'
|
2023-04-11 19:25:29 +10:00
|
|
|
require 'rails/generators/testing/assertions'
|
|
|
|
|
|
|
|
require 'generators/post_deployment_migration/post_deployment_migration_generator'
|
|
|
|
|
2024-09-04 15:12:25 +10:00
|
|
|
RSpec.describe PostDeploymentMigrationGenerator, type: :generator do
|
2023-10-24 04:58:29 +11:00
|
|
|
include Rails::Generators::Testing::Behavior
|
2023-04-11 19:25:29 +10:00
|
|
|
include Rails::Generators::Testing::Assertions
|
|
|
|
include FileUtils
|
|
|
|
|
|
|
|
tests described_class
|
2023-12-07 09:22:25 +11:00
|
|
|
destination Rails.root.join('tmp', 'generator-test')
|
2023-04-11 19:25:29 +10:00
|
|
|
before { prepare_destination }
|
|
|
|
after { rm_rf(destination_root) }
|
|
|
|
|
|
|
|
describe 'the migration' do
|
|
|
|
it 'generates expected file' do
|
|
|
|
run_generator %w(Changes)
|
|
|
|
|
|
|
|
assert_migration('db/post_migrate/changes.rb', /disable_ddl/)
|
|
|
|
assert_migration('db/post_migrate/changes.rb', /change/)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|