diff options
author | Rémy Coutable <remy@rymai.me> | 2016-11-16 15:17:09 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-11-16 15:35:15 +0100 |
commit | d47fca53db5840e85d38b35058d4bbd94ea917db (patch) | |
tree | ede2db2153f40e4b929a65d166206b369c45a90f /spec/models/event_spec.rb | |
parent | 1263708d81dcb978b44139a2965d384dff310fcc (diff) | |
download | gitlab-ce-d47fca53db5840e85d38b35058d4bbd94ea917db.tar.gz |
Allow commit note to be visible if repo is visible23824-activity-page-does-not-show-commits-comments
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/models/event_spec.rb')
-rw-r--r-- | spec/models/event_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 29a3af68a9b..b684053cd02 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -94,6 +94,7 @@ describe Event, models: true do let(:admin) { create(:admin) } let(:issue) { create(:issue, project: project, author: author, assignee: assignee) } let(:confidential_issue) { create(:issue, :confidential, project: project, author: author, assignee: assignee) } + let(:note_on_commit) { create(:note_on_commit, project: project) } let(:note_on_issue) { create(:note_on_issue, noteable: issue, project: project) } let(:note_on_confidential_issue) { create(:note_on_issue, noteable: confidential_issue, project: project) } let(:event) { Event.new(project: project, target: target, author_id: author.id) } @@ -103,6 +104,32 @@ describe Event, models: true do project.team << [guest, :guest] end + context 'commit note event' do + let(:target) { note_on_commit } + + it do + aggregate_failures do + expect(event.visible_to_user?(non_member)).to eq true + expect(event.visible_to_user?(member)).to eq true + expect(event.visible_to_user?(guest)).to eq true + expect(event.visible_to_user?(admin)).to eq true + end + end + + context 'private project' do + let(:project) { create(:empty_project, :private) } + + it do + aggregate_failures do + expect(event.visible_to_user?(non_member)).to eq false + expect(event.visible_to_user?(member)).to eq true + expect(event.visible_to_user?(guest)).to eq false + expect(event.visible_to_user?(admin)).to eq true + end + end + end + end + context 'issue event' do context 'for non confidential issues' do let(:target) { issue } |