Sha256: cd247a45e4ef7939035f871ba846877c7f485213b2236609b5556405e657693a

Contents?: true

Size: 1013 Bytes

Versions: 16

Compression:

Stored size: 1013 Bytes

Contents

require "cases/helper"

module ActiveRecord
  class Migration
    class << self; attr_accessor :message_count; end
    self.message_count = 0

    module TestHelper
      attr_reader :connection, :table_name

      CONNECTION_METHODS = %w[add_column remove_column rename_column add_index change_column rename_table column_exists? index_exists? add_reference add_belongs_to remove_reference remove_references remove_belongs_to]

      class TestModel < ActiveRecord::Base
        self.table_name = :test_models
      end

      def setup
        super
        @connection = ActiveRecord::Base.connection
        connection.create_table :test_models do |t|
          t.timestamps null: true
        end

        TestModel.reset_column_information
      end

      def teardown
        super
        TestModel.reset_table_name
        TestModel.reset_sequence_name
        connection.drop_table :test_models rescue nil
      end

      private

      delegate(*CONNECTION_METHODS, to: :connection)
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
ibm_db-5.2.0 test/cases/migration/helper.rb
ibm_db-5.1.0 test/cases/migration/helper.rb
ibm_db-5.0.5 test/cases/migration/helper.rb
ibm_db-5.0.4 test/cases/migration/helper.rb
ibm_db-5.0.3 test/cases/migration/helper.rb
ibm_db-5.0.2 test/cases/migration/helper.rb
ibm_db-3.0.4-x86-mingw32 test/cases/migration/helper.rb
ibm_db-3.0.4 test/cases/migration/helper.rb
ibm_db-3.0.3-x86-mingw32 test/cases/migration/helper.rb
ibm_db-3.0.3 test/cases/migration/helper.rb
ibm_db-3.0.2-x86-mingw32 test/cases/migration/helper.rb
ibm_db-3.0.2 test/cases/migration/helper.rb
activejob-lock-0.0.2 rails/activerecord/test/cases/migration/helper.rb
ibm_db-3.0.1 test/cases/migration/helper.rb
ibm_db-3.0.1-x86-mingw32 test/cases/migration/helper.rb
activejob-lock-0.0.1 rails/activerecord/test/cases/migration/helper.rb