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/add_upvotes_count_index_to_issues_spec.rb')
-rw-r--r--spec/migrations/add_upvotes_count_index_to_issues_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/migrations/add_upvotes_count_index_to_issues_spec.rb b/spec/migrations/add_upvotes_count_index_to_issues_spec.rb
new file mode 100644
index 00000000000..c04cb98a107
--- /dev/null
+++ b/spec/migrations/add_upvotes_count_index_to_issues_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require_migration!
+
+RSpec.describe AddUpvotesCountIndexToIssues do
+ let(:migration_instance) { described_class.new }
+
+ describe '#up' do
+ it 'adds index' do
+ expect { migrate! }.to change { migration_instance.index_exists?(:issues, [:project_id, :upvotes_count], name: described_class::INDEX_NAME) }.from(false).to(true)
+ end
+ end
+
+ describe '#down' do
+ it 'removes index' do
+ migrate!
+
+ expect { schema_migrate_down! }.to change { migration_instance.index_exists?(:issues, [:project_id, :upvotes_count], name: described_class::INDEX_NAME) }.from(true).to(false)
+ end
+ end
+end