summaryrefslogtreecommitdiff
path: root/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb
blob: 6f9cfe4764a6afb14f15a84c92ae03fd91a5ba33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'spec_helper'
require_migration!

RSpec.describe RemoveTempIndexForProjectStatisticsUploadSizeMigration,
feature_category: :subscription_cost_management do
  let(:table_name) { 'project_statistics' }
  let(:index_name) { described_class::INDEX_NAME }

  it 'correctly migrates up and down' do
    reversible_migration do |migration|
      migration.before -> {
        expect(subject.index_exists_by_name?(table_name, index_name)).to be_truthy
      }

      migration.after -> {
        expect(subject.index_exists_by_name?(table_name, index_name)).to be_falsy
      }
    end
  end
end