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

require 'spec_helper'
require_migration!

RSpec.describe ToggleVsaAggregationsEnable, :migration do
  let(:aggregations) { table(:analytics_cycle_analytics_aggregations) }
  let(:groups) { table(:namespaces) }

  let!(:group1) { groups.create!(name: 'aaa', path: 'aaa') }
  let!(:group2) { groups.create!(name: 'aaa', path: 'aaa') }
  let!(:group3) { groups.create!(name: 'aaa', path: 'aaa') }

  let!(:aggregation1) { aggregations.create!(group_id: group1.id, enabled: false) }
  let!(:aggregation2) { aggregations.create!(group_id: group2.id, enabled: true) }
  let!(:aggregation3) { aggregations.create!(group_id: group3.id, enabled: false) }

  it 'makes all aggregations enabled' do
    migrate!

    expect(aggregation1.reload).to be_enabled
    expect(aggregation2.reload).to be_enabled
    expect(aggregation3.reload).to be_enabled
  end
end