|
@@ -3,13 +3,12 @@ require 'rails_helper'
|
|
|
RSpec.describe Issue1977RemoveInvalidUserForeignKeys, type: :db_migration do
|
|
|
|
|
|
context 'no online_notifications foreign key' do
|
|
|
- self.use_transactional_tests = false
|
|
|
|
|
|
let(:existing_user_id) { User.first.id }
|
|
|
|
|
|
context 'invalid User foreign key columns' do
|
|
|
|
|
|
- it 'cleans up OnlineNotification#user_id' do
|
|
|
+ it 'cleans up OnlineNotification#user_id', db_strategy: :truncation do
|
|
|
witout_foreign_key(:online_notifications, column: :user_id)
|
|
|
|
|
|
create(:online_notification, user_id: 1337)
|
|
@@ -20,13 +19,9 @@ RSpec.describe Issue1977RemoveInvalidUserForeignKeys, type: :db_migration do
|
|
|
end.to change {
|
|
|
OnlineNotification.count
|
|
|
}.by(-1)
|
|
|
-
|
|
|
- # cleanup since we disabled
|
|
|
- # transactions for this tests
|
|
|
- valid.destroy
|
|
|
end
|
|
|
|
|
|
- it 'cleans up RecentView#created_by_id' do
|
|
|
+ it 'cleans up RecentView#created_by_id', db_strategy: :truncation do
|
|
|
witout_foreign_key(:online_notifications, column: :user_id)
|
|
|
witout_foreign_key(:recent_views, column: :created_by_id)
|
|
|
|
|
@@ -38,13 +33,9 @@ RSpec.describe Issue1977RemoveInvalidUserForeignKeys, type: :db_migration do
|
|
|
end.to change {
|
|
|
RecentView.count
|
|
|
}.by(-1)
|
|
|
-
|
|
|
- # cleanup since we disabled
|
|
|
- # transactions for this tests
|
|
|
- valid.destroy
|
|
|
end
|
|
|
|
|
|
- it 'cleans up Avatar#o_id' do
|
|
|
+ it 'cleans up Avatar#o_id', db_strategy: :truncation do
|
|
|
witout_foreign_key(:online_notifications, column: :user_id)
|
|
|
|
|
|
create(:avatar, object_lookup_id: ObjectLookup.by_name('User'), o_id: 1337)
|
|
@@ -56,11 +47,6 @@ RSpec.describe Issue1977RemoveInvalidUserForeignKeys, type: :db_migration do
|
|
|
end.to change {
|
|
|
Avatar.count
|
|
|
}.by(-1)
|
|
|
-
|
|
|
- # cleanup since we disabled
|
|
|
- # transactions for this tests
|
|
|
- valid_ticket.destroy
|
|
|
- valid_user.destroy
|
|
|
end
|
|
|
|
|
|
end
|