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

set_confidential_note_events_on_webhooks_spec.rb « background_migration « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08f1f543f5de35ea5c1b0ebc6b8c53361abc6a15 (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
26
27
28
29
30
31
32
33
# frozen_string_literal: true

require 'spec_helper'

describe Gitlab::BackgroundMigration::SetConfidentialNoteEventsOnWebhooks, schema: 20180104131052 do
  let(:web_hooks) { table(:web_hooks) }

  describe '#perform' do
    it 'migrates hooks where note_events is true' do
      hook = web_hooks.create(confidential_note_events: nil, note_events: true)

      subject.perform(hook.id, hook.id)

      expect(hook.reload.confidential_note_events).to eq(true)
    end

    it 'ignores hooks where note_events is false' do
      hook = web_hooks.create(confidential_note_events: nil, note_events: false)

      subject.perform(hook.id, hook.id)

      expect(hook.reload.confidential_note_events).to eq(nil)
    end

    it 'ignores hooks where confidential_note_events has already been set' do
      hook = web_hooks.create(confidential_note_events: false, note_events: true)

      subject.perform(hook.id, hook.id)

      expect(hook.reload.confidential_note_events).to eq(false)
    end
  end
end