Sha256: ecf2c9697f7aef819cb9dc60fb805edf23afd7e80d7e3e6f3d6cbef584fbe748

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper_integration'
require 'generators/doorkeeper/migration_generator'

describe 'Doorkeeper::MigrationGenerator' do
  include GeneratorSpec::TestCase

  tests Doorkeeper::MigrationGenerator
  destination ::File.expand_path('../tmp/dummy', __FILE__)

  describe 'after running the generator' do
    before :each do
      prepare_destination
    end

    context 'pre Rails 5.0.0' do
      it 'creates a migration with no version specifier' do
        stub_const('ActiveRecord::VERSION::MAJOR', 4)
        stub_const('ActiveRecord::VERSION::MINOR', 2)

        run_generator

        assert_migration 'db/migrate/create_doorkeeper_tables.rb' do |migration|
          assert migration.include?("ActiveRecord::Migration\n")
        end
      end
    end

    context 'post Rails 5.0.0' do
      it 'creates a migration with a version specifier' do
        stub_const('ActiveRecord::VERSION::MAJOR', 5)
        stub_const('ActiveRecord::VERSION::MINOR', 0)

        run_generator

        assert_migration 'db/migrate/create_doorkeeper_tables.rb' do |migration|
          assert migration.include?("ActiveRecord::Migration[5.0]\n")
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
doorkeeper-4.4.3 spec/generators/migration_generator_spec.rb
doorkeeper-4.4.2 spec/generators/migration_generator_spec.rb
doorkeeper-4.4.1 spec/generators/migration_generator_spec.rb
doorkeeper-4.4.0 spec/generators/migration_generator_spec.rb
doorkeeper-4.3.2 spec/generators/migration_generator_spec.rb
doorkeeper-4.3.1 spec/generators/migration_generator_spec.rb
doorkeeper-4.3.0 spec/generators/migration_generator_spec.rb