2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Mutations::MergeRequests::SetAssignees do
|
2021-01-29 00:20:46 +05:30
|
|
|
context 'when the user does not have permissions' do
|
|
|
|
let_it_be(:merge_request) { create(:merge_request) }
|
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:assignee) { create(:user) }
|
|
|
|
|
|
|
|
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
|
|
|
|
|
|
|
|
describe '#resolve' do
|
2021-04-29 21:17:54 +05:30
|
|
|
subject do
|
|
|
|
mutation.resolve(project_path: merge_request.project.full_path,
|
|
|
|
iid: merge_request.iid,
|
|
|
|
operation_mode: described_class.arguments['operationMode'].default_value,
|
|
|
|
assignee_usernames: [assignee.username])
|
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
it_behaves_like 'permission level for merge request mutation is correctly verified'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
it_behaves_like 'an assignable resource' do
|
|
|
|
let_it_be(:resource, reload: true) { create(:merge_request) }
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|