diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-01-24 18:10:22 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-04-03 17:05:53 +0300 |
commit | 1a8d6f6f38c1d8d9b977e658105091eddc5ec67e (patch) | |
tree | eaeea334d975a097a139bf27154a9de631c37b23 /spec/models/note_spec.rb | |
parent | 3760b3f13ea9bea18a5e74ad4fa743221288ceb6 (diff) |
Merge branch 'jej/mattermost-notification-confidentiality' into 'security-10-4'
Prevent notes on confidential issues from being sent to chat
See merge request gitlab/gitlabhq!2248
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r-- | spec/models/note_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 3d030927036..77ea791bd9f 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -193,6 +193,21 @@ describe Note do end end + describe "confidential?" do + it "delegates to noteable" do + issue_note = build(:note, :on_issue) + confidential_note = build(:note, noteable: create(:issue, confidential: true)) + + expect(issue_note.confidential?).to be_falsy + expect(confidential_note.confidential?).to be_truthy + end + + it "is falsey when noteable can't be confidential" do + commit_note = build(:note_on_commit) + expect(commit_note.confidential?).to be_falsy + end + end + describe "cross_reference_not_visible_for?" do let(:private_user) { create(:user) } let(:private_project) { create(:project, namespace: private_user.namespace) { |p| p.add_master(private_user) } } |