class ActiveRecord::Migration::ColumnPositioningTest
Attributes
conn[R]
connection[R]
Public Instance Methods
setup()
click to toggle source
Calls superclass method
# File activerecord/test/cases/migration/column_positioning_test.rb, line 11 def setup super @connection = ActiveRecord::Base.connection connection.create_table :testings, id: false do |t| t.column :first, :integer t.column :second, :integer t.column :third, :integer end end
test_add_column_with_positioning()
click to toggle source
# File activerecord/test/cases/migration/column_positioning_test.rb, line 33 def test_add_column_with_positioning conn.add_column :testings, :new_col, :integer assert_equal %w(first second third new_col), conn.columns(:testings).map(&:name) end
test_add_column_with_positioning_after()
click to toggle source
# File activerecord/test/cases/migration/column_positioning_test.rb, line 43 def test_add_column_with_positioning_after conn.add_column :testings, :new_col, :integer, after: :first assert_equal %w(first new_col second third), conn.columns(:testings).map(&:name) end
test_add_column_with_positioning_first()
click to toggle source
# File activerecord/test/cases/migration/column_positioning_test.rb, line 38 def test_add_column_with_positioning_first conn.add_column :testings, :new_col, :integer, first: true assert_equal %w(new_col first second third), conn.columns(:testings).map(&:name) end
test_change_column_with_positioning()
click to toggle source
# File activerecord/test/cases/migration/column_positioning_test.rb, line 48 def test_change_column_with_positioning conn.change_column :testings, :second, :integer, first: true assert_equal %w(second first third), conn.columns(:testings).map(&:name) conn.change_column :testings, :second, :integer, after: :third assert_equal %w(first third second), conn.columns(:testings).map(&:name) end
test_column_positioning()
click to toggle source
# File activerecord/test/cases/migration/column_positioning_test.rb, line 29 def test_column_positioning assert_equal %w(first second third), conn.columns(:testings).map(&:name) end