diff options
author | Sean McGivern <sean@gitlab.com> | 2018-03-02 15:03:03 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-03-02 19:16:13 +0300 |
commit | daeeb7f8480d747d500ea3aeddb479a29e890562 (patch) | |
tree | 9c9a9f02a4f91ab51b8bf60ea6ca3b94f3cced0a /spec/services/notes/quick_actions_service_spec.rb | |
parent | 40c61acb6a9ba84928cebcbce8b57630bd439615 (diff) |
Fix quick actions for users who cannot update issues and MRs
There are several quick actions now that don't need this access - /todo and
/unsubscribe for instance - but when these were first added, there
weren't. Quick actions are now responsible for checking their own permissions.
Diffstat (limited to 'spec/services/notes/quick_actions_service_spec.rb')
-rw-r--r-- | spec/services/notes/quick_actions_service_spec.rb | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/spec/services/notes/quick_actions_service_spec.rb b/spec/services/notes/quick_actions_service_spec.rb index 5eafe56c99d..b1e218821d2 100644 --- a/spec/services/notes/quick_actions_service_spec.rb +++ b/spec/services/notes/quick_actions_service_spec.rb @@ -165,31 +165,17 @@ describe Notes::QuickActionsService do let(:note) { create(:note_on_issue, project: project) } - context 'with no current_user' do - it 'returns false' do - expect(described_class.supported?(note, nil)).to be_falsy - end - end - - context 'when current_user cannot update the noteable' do - it 'returns false' do - user = create(:user) - - expect(described_class.supported?(note, user)).to be_falsy - end - end - - context 'when current_user can update the noteable' do + context 'with a note on an issue' do it 'returns true' do - expect(described_class.supported?(note, master)).to be_truthy + expect(described_class.supported?(note)).to be_truthy end + end - context 'with a note on a commit' do - let(:note) { create(:note_on_commit, project: project) } + context 'with a note on a commit' do + let(:note) { create(:note_on_commit, project: project) } - it 'returns false' do - expect(described_class.supported?(note, nil)).to be_falsy - end + it 'returns false' do + expect(described_class.supported?(note)).to be_falsy end end end @@ -201,7 +187,7 @@ describe Notes::QuickActionsService do service = described_class.new(project, master) note = create(:note_on_issue, project: project) - expect(described_class).to receive(:supported?).with(note, master) + expect(described_class).to receive(:supported?).with(note) service.supported?(note) end |