diff options
author | James Lopez <james@jameslopez.es> | 2016-06-16 13:04:00 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-16 13:04:00 +0200 |
commit | 778d72664f386dfee45dab171f137395739958f6 (patch) | |
tree | 7f2c902f4b97ac29aa97e96e877da201130a33b3 /spec/models/note_spec.rb | |
parent | 452c076a34cc11cc97f4b1c3113e86ce4367e055 (diff) | |
parent | c369cc8bf42a680b2b0fc9721a9a7926dc5426f6 (diff) | |
download | gitlab-ce-feature/project-export.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into feature/project-exportfeature/project-export
# Conflicts:
# app/models/ci/pipeline.rb
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r-- | spec/models/note_spec.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index f15e96714b2..285ab19cfaf 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -162,16 +162,23 @@ describe Note, models: true do end context "confidential issues" do - let(:user) { create :user } - let(:confidential_issue) { create(:issue, :confidential, author: user) } - let(:confidential_note) { create :note, note: "Random", noteable: confidential_issue, project: confidential_issue.project } + let(:user) { create(:user) } + let(:project) { create(:project) } + let(:confidential_issue) { create(:issue, :confidential, project: project, author: user) } + let(:confidential_note) { create(:note, note: "Random", noteable: confidential_issue, project: confidential_issue.project) } it "returns notes with matching content if user can see the issue" do expect(described_class.search(confidential_note.note, as_user: user)).to eq([confidential_note]) end it "does not return notes with matching content if user can not see the issue" do - user = create :user + user = create(:user) + expect(described_class.search(confidential_note.note, as_user: user)).to be_empty + end + + it "does not return notes with matching content for project members with guest role" do + user = create(:user) + project.team << [user, :guest] expect(described_class.search(confidential_note.note, as_user: user)).to be_empty end |