Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb')
-rw-r--r--spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb b/spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb
new file mode 100644
index 00000000000..8cb6ab23fef
--- /dev/null
+++ b/spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require_migration!
+
+RSpec.describe AddUserIdAndIpAddressSuccessIndexToAuthenticationEvents do
+ let(:db) { described_class.new }
+ let(:old_index) { described_class::OLD_INDEX_NAME }
+ let(:new_index) { described_class::NEW_INDEX_NAME }
+
+ it 'correctly migrates up and down' do
+ reversible_migration do |migration|
+ migration.before -> {
+ expect(db.connection.indexes(:authentication_events).map(&:name)).to include(old_index)
+ expect(db.connection.indexes(:authentication_events).map(&:name)).not_to include(new_index)
+ }
+
+ migration.after -> {
+ expect(db.connection.indexes(:authentication_events).map(&:name)).to include(new_index)
+ expect(db.connection.indexes(:authentication_events).map(&:name)).not_to include(old_index)
+ }
+ end
+ end
+end