summaryrefslogtreecommitdiff
path: root/spec/services/issuable
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-12-14 19:39:53 -0200
committerFelipe Artur <felipefac@gmail.com>2016-12-27 19:25:17 -0200
commit1b082a4c338d7575e15d7450906801db59873441 (patch)
tree1b5081ce55b63436082b038f499a8c54172fc75a /spec/services/issuable
parent77deeb12f74b857f9356168ccdf92612fc85fe84 (diff)
downloadgitlab-ce-1b082a4c338d7575e15d7450906801db59873441.tar.gz
Check if user can read issue before being assignedissue_22664
Diffstat (limited to 'spec/services/issuable')
-rw-r--r--spec/services/issuable/bulk_update_service_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/services/issuable/bulk_update_service_spec.rb b/spec/services/issuable/bulk_update_service_spec.rb
index 5f3020b6525..0475f38fe5e 100644
--- a/spec/services/issuable/bulk_update_service_spec.rb
+++ b/spec/services/issuable/bulk_update_service_spec.rb
@@ -52,7 +52,10 @@ describe Issuable::BulkUpdateService, services: true do
context 'when the new assignee ID is a valid user' do
it 'succeeds' do
- result = bulk_update(issue, assignee_id: create(:user).id)
+ new_assignee = create(:user)
+ project.team << [new_assignee, :developer]
+
+ result = bulk_update(issue, assignee_id: new_assignee.id)
expect(result[:success]).to be_truthy
expect(result[:count]).to eq(1)
@@ -60,15 +63,16 @@ describe Issuable::BulkUpdateService, services: true do
it 'updates the assignee to the use ID passed' do
assignee = create(:user)
+ project.team << [assignee, :developer]
expect { bulk_update(issue, assignee_id: assignee.id) }
.to change { issue.reload.assignee }.from(user).to(assignee)
end
end
- context 'when the new assignee ID is -1' do
- it 'unassigns the issues' do
- expect { bulk_update(issue, assignee_id: -1) }
+ context "when the new assignee ID is #{IssuableFinder::NONE}" do
+ it "unassigns the issues" do
+ expect { bulk_update(issue, assignee_id: IssuableFinder::NONE) }
.to change { issue.reload.assignee }.to(nil)
end
end