mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
c81af6ae72
We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
40 lines
1 KiB
Ruby
40 lines
1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
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, if_exists: true
|
|
end
|
|
|
|
private
|
|
delegate(*CONNECTION_METHODS, to: :connection)
|
|
end
|
|
end
|
|
end
|