about summary refs log tree commit diff
path: root/spec/generators/post_deployment_migration_generator_spec.rb
blob: d552880e3bd33b419f2b4254763391c5e69eee66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require 'rails_helper'
require 'rails/generators/testing/behaviour'
require 'rails/generators/testing/assertions'

require 'generators/post_deployment_migration/post_deployment_migration_generator'

describe PostDeploymentMigrationGenerator, type: :generator do
  include Rails::Generators::Testing::Behaviour
  include Rails::Generators::Testing::Assertions
  include FileUtils

  tests described_class
  destination File.expand_path('../../tmp', __dir__)
  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