blob: 8ecaaa46bed0c848baa7809f3921a0a737e957a2 (
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
52
53
54
55
56
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Types::MemberInterface do
it 'exposes the expected fields' do
expected_fields = %i[
id
access_level
created_by
created_at
updated_at
expires_at
user
merge_request_interaction
]
expect(described_class).to have_graphql_fields(*expected_fields)
end
describe '.resolve_type' do
subject { described_class.resolve_type(object, {}) }
context 'for project member' do
let(:object) { build(:project_member) }
it { is_expected.to be Types::ProjectMemberType }
end
context 'for group member' do
let(:object) { build(:group_member) }
it { is_expected.to be Types::GroupMemberType }
end
context 'for an unkown type' do
let(:object) { build(:user) }
it 'raises an error' do
expect { subject }.to raise_error(Gitlab::Graphql::Errors::BaseError)
end
end
end
describe '#merge_request_interaction' do
subject { described_class.fields['mergeRequestInteraction'] }
it 'returns the correct type' do
is_expected.to have_graphql_type(Types::UserMergeRequestInteractionType)
end
it 'has the correct arguments' do
expect(subject.arguments).to have_key('id')
end
end
end
|