diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2019-06-07 19:13:26 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2019-06-14 12:36:27 +0200 |
commit | b6ff5f1e141162e701c33647aae5015e5d42cc11 (patch) | |
tree | fb6ec57e96dc811d07c75d6b32f9471263c85166 /spec/policies | |
parent | 8934ddbb47d24dac937351588bc28551bd7654e7 (diff) | |
download | gitlab-ce-b6ff5f1e141162e701c33647aae5015e5d42cc11.tar.gz |
Expose comments on Noteables in GraphQL
This exposes `Note`s on Issues & MergeRequests using a
`Types::Notes::NoteableType` in GraphQL.
Exposing notes on a new type can be done by implementing the
`NoteableType` interface on the type. The presented object should
be a `Noteable`.
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/note_policy_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/policies/note_policy_spec.rb b/spec/policies/note_policy_spec.rb index 4be7a0266d1..bcf021f1dfd 100644 --- a/spec/policies/note_policy_spec.rb +++ b/spec/policies/note_policy_spec.rb @@ -133,6 +133,25 @@ describe NotePolicy do end end end + + context 'for discussions' do + let(:policy) { described_class.new(user, note.discussion) } + + it 'allows the author to manage the discussion' do + expect(policy).to be_allowed(:admin_note) + expect(policy).to be_allowed(:resolve_note) + expect(policy).to be_allowed(:read_note) + expect(policy).to be_allowed(:award_emoji) + end + + context 'when the user does not have access to the noteable' do + before do + noteable.update_attribute(:confidential, true) + end + + it_behaves_like 'a discussion with a private noteable' + end + end end end end |