blob: 8f5f2e0879921ef21568d89079da224f3ee1c864 (
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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Types::BaseArgument do
let_it_be(:field) do
Types::BaseField.new(name: 'field', type: String, null: true)
end
let(:base_args) { { name: 'test', type: String, required: false, owner: field } }
def subject(args = {})
described_class.new(**base_args.merge(args))
end
include_examples 'Gitlab-style deprecations'
describe 'required argument declarations' do
it 'accepts nullable, required arguments' do
arguments = base_args.merge({ required: :nullable })
expect { subject(arguments) }.not_to raise_error
end
it 'accepts required, non-nullable arguments' do
arguments = base_args.merge({ required: true })
expect { subject(arguments) }.not_to raise_error
end
it 'accepts non-required arguments' do
arguments = base_args.merge({ required: false })
expect { subject(arguments) }.not_to raise_error
end
it 'accepts no required argument declaration' do
arguments = base_args
expect { subject(arguments) }.not_to raise_error
end
end
end
|