diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-04-03 09:57:41 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-04-03 14:53:19 +0100 |
commit | b7d6225a448b1191b0c982ca73343f4172dbd999 (patch) | |
tree | db0b8789af3efeeea269c003bd19c966694118bb /spec/lib/gitlab/background_migration/set_confidential_note_events_on_webhooks_spec.rb | |
parent | 3bac94ee97217252ca1bb8849628564a5932ab6f (diff) | |
download | gitlab-ce-b7d6225a448b1191b0c982ca73343f4172dbd999.tar.gz |
Merge branch 'jej/mattermost-notification-confidentiality-10-5' into 'security-10-5'
[10.5] Prevent notes on confidential issues from being sent to chat
See merge request gitlab/gitlabhq!2339
Diffstat (limited to 'spec/lib/gitlab/background_migration/set_confidential_note_events_on_webhooks_spec.rb')
-rw-r--r-- | spec/lib/gitlab/background_migration/set_confidential_note_events_on_webhooks_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration/set_confidential_note_events_on_webhooks_spec.rb b/spec/lib/gitlab/background_migration/set_confidential_note_events_on_webhooks_spec.rb new file mode 100644 index 00000000000..82b484b7d5b --- /dev/null +++ b/spec/lib/gitlab/background_migration/set_confidential_note_events_on_webhooks_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe Gitlab::BackgroundMigration::SetConfidentialNoteEventsOnWebhooks, :migration, 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 |