Sha256: c119ed73d43f542970d8ad36edcbc179d0e681d8c6486e0326e53a79e66ca0a9

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper_integration'
require 'generators/doorkeeper/application_owner_generator'

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

  tests Doorkeeper::ApplicationOwnerGenerator
  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/add_owner_to_application.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/add_owner_to_application.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/application_owner_generator_spec.rb
doorkeeper-4.4.2 spec/generators/application_owner_generator_spec.rb
doorkeeper-4.4.1 spec/generators/application_owner_generator_spec.rb
doorkeeper-4.4.0 spec/generators/application_owner_generator_spec.rb
doorkeeper-4.3.2 spec/generators/application_owner_generator_spec.rb
doorkeeper-4.3.1 spec/generators/application_owner_generator_spec.rb
doorkeeper-4.3.0 spec/generators/application_owner_generator_spec.rb