blob: 8c6dca98bad6c08b2d37e5b040480fc99264e7c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mutations::Todos::Create do
include GraphqlHelpers
include DesignManagementTestHelpers
describe '#resolve' do
context 'when target does not support todos' do
it 'raises error' do
current_user = create(:user)
target = create(:milestone)
ctx = { current_user: current_user }
input = { target_id: global_id_of(target).to_s }
mutation = graphql_mutation(described_class, input)
response = GitlabSchema.execute(mutation.query, context: ctx, variables: mutation.variables).to_h
expect(response).to include(
'errors' => contain_exactly(
include('message' => /invalid value for targetId/)
)
)
end
end
context 'with issue as target' do
it_behaves_like 'create todo mutation' do
let_it_be(:target) { create(:issue) }
end
end
context 'with merge request as target' do
it_behaves_like 'create todo mutation' do
let_it_be(:target) { create(:merge_request) }
end
end
context 'with design as target' do
before do
enable_design_management
end
it_behaves_like 'create todo mutation' do
let_it_be(:target) { create(:design) }
end
end
end
end
|