Add test coverage for bulk altering timestamps

This commit is contained in:
Eugene Kenny 2021-04-28 03:30:01 +01:00
parent 4913525180
commit 217f0e81d1
1 changed files with 36 additions and 0 deletions

View File

@ -1177,6 +1177,42 @@ if ActiveRecord::Base.connection.supports_bulk_alter?
assert column(:qualification_experience)
end
def test_adding_timestamps
with_bulk_change_table do |t|
t.string :title
end
assert column(:title)
assert_queries(1) do
with_bulk_change_table do |t|
t.timestamps
t.remove :title
end
end
[:created_at, :updated_at].each { |c| assert column(c) }
assert_not column(:title)
end
def test_removing_timestamps
with_bulk_change_table do |t|
t.timestamps
end
[:created_at, :updated_at].each { |c| assert column(c) }
assert_queries(1) do
with_bulk_change_table do |t|
t.remove_timestamps
t.string :title
end
end
[:created_at, :updated_at].each { |c| assert_not column(c) }
assert column(:title)
end
def test_adding_indexes
with_bulk_change_table do |t|
t.string :username