graphlient 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +38 -38
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -20
  4. data/.github/workflows/ci.yml +33 -29
  5. data/.github/workflows/danger-comment.yml +10 -0
  6. data/.github/workflows/danger.yml +13 -22
  7. data/.github/workflows/rubocop.yml +19 -19
  8. data/.gitignore +59 -52
  9. data/.rspec +1 -1
  10. data/.rubocop.yml +26 -28
  11. data/.rubocop_todo.yml +72 -48
  12. data/CHANGELOG.md +128 -107
  13. data/CONTRIBUTING.md +125 -125
  14. data/Dangerfile +24 -24
  15. data/Gemfile +35 -27
  16. data/LICENSE +21 -21
  17. data/README.md +800 -508
  18. data/RELEASING.md +63 -63
  19. data/Rakefile +15 -15
  20. data/UPGRADING.md +23 -23
  21. data/graphlient.gemspec +19 -19
  22. data/lib/graphlient/adapters/http/adapter.rb +41 -41
  23. data/lib/graphlient/adapters/http/faraday_adapter.rb +79 -45
  24. data/lib/graphlient/adapters/http/http_adapter.rb +40 -39
  25. data/lib/graphlient/adapters/http.rb +3 -3
  26. data/lib/graphlient/adapters.rb +1 -1
  27. data/lib/graphlient/client.rb +98 -73
  28. data/lib/graphlient/errors/client_error.rb +6 -6
  29. data/lib/graphlient/errors/connection_failed_error.rb +6 -6
  30. data/lib/graphlient/errors/error.rb +13 -12
  31. data/lib/graphlient/errors/execution_error.rb +29 -29
  32. data/lib/graphlient/errors/faraday_server_error.rb +12 -12
  33. data/lib/graphlient/errors/graphql_error.rb +53 -52
  34. data/lib/graphlient/errors/http_options_error.rb +6 -6
  35. data/lib/graphlient/errors/http_server_error.rb +13 -13
  36. data/lib/graphlient/errors/server_error.rb +7 -7
  37. data/lib/graphlient/errors/timeout_error.rb +6 -6
  38. data/lib/graphlient/errors.rb +10 -10
  39. data/lib/graphlient/extensions/query.rb +15 -15
  40. data/lib/graphlient/extensions.rb +1 -1
  41. data/lib/graphlient/query/directive.rb +47 -0
  42. data/lib/graphlient/query/serializer/arguments.rb +67 -0
  43. data/lib/graphlient/query/serializer/directives.rb +17 -0
  44. data/lib/graphlient/query/serializer/evaluator.rb +15 -0
  45. data/lib/graphlient/query/serializer/fragments.rb +28 -0
  46. data/lib/graphlient/query/serializer/scalars.rb +63 -0
  47. data/lib/graphlient/query/serializer.rb +153 -0
  48. data/lib/graphlient/query.rb +29 -128
  49. data/lib/graphlient/schema.rb +27 -26
  50. data/lib/graphlient/version.rb +3 -3
  51. data/lib/graphlient.rb +8 -8
  52. data/spec/graphlient/adapters/http/faraday_adapter_spec.rb +172 -112
  53. data/spec/graphlient/adapters/http/http_adapter_spec.rb +60 -60
  54. data/spec/graphlient/client_dsl_spec.rb +153 -0
  55. data/spec/graphlient/client_query_spec.rb +369 -346
  56. data/spec/graphlient/client_schema_spec.rb +75 -55
  57. data/spec/graphlient/extensions/query_spec.rb +16 -16
  58. data/spec/graphlient/github_query_spec.rb +32 -32
  59. data/spec/graphlient/query_dsl_spec.rb +231 -0
  60. data/spec/graphlient/query_spec.rb +105 -105
  61. data/spec/graphlient/schema_spec.rb +56 -56
  62. data/spec/graphlient/static_client_query_spec.rb +75 -68
  63. data/spec/graphlient/webmock_client_query_spec.rb +41 -41
  64. data/spec/spec_helper.rb +26 -14
  65. data/spec/support/context/dummy_client.rb +33 -26
  66. data/spec/support/context/github_client.rb +18 -18
  67. data/spec/support/dummy_app.rb +21 -19
  68. data/spec/support/dummy_schema.rb +17 -17
  69. data/spec/support/fixtures/github/schema.yml +14282 -14282
  70. data/spec/support/fixtures/github/user.yml +76 -76
  71. data/spec/support/fixtures/github/viewer.yml +76 -76
  72. data/spec/support/fixtures/invoice_api.json +1288 -1288
  73. data/spec/support/mutations/create_invoice.rb +18 -18
  74. data/spec/support/queries/query.rb +48 -47
  75. data/spec/support/schema/github.json +44479 -44479
  76. data/spec/support/types/invoice_type.rb +13 -13
  77. data/spec/support/types/mutation_type.rb +5 -5
  78. data/spec/support/vcr.rb +9 -9
  79. metadata +13 -8
  80. data/Gemfile.danger +0 -5
@@ -1,346 +1,369 @@
1
- require 'spec_helper'
2
-
3
- describe Graphlient::Client do
4
- include_context 'Dummy Client'
5
-
6
- describe 'parse and execute' do
7
- context 'non-parameterized query' do
8
- let(:query) do
9
- client.parse do
10
- query do
11
- invoice(id: 10) do
12
- id
13
- feeInCents
14
- end
15
- end
16
- end
17
- end
18
-
19
- it '#parse' do
20
- expect(query).to be_a GraphQL::Client::OperationDefinition
21
- end
22
-
23
- it '#execute' do
24
- response = client.execute(query)
25
- invoice = response.data.invoice
26
- expect(invoice.id).to eq '10'
27
- end
28
-
29
- context 'with fragment' do
30
- let(:invoice_fragment) do
31
- client.parse <<~'GRAPHQL'
32
- fragment on Invoice {
33
- id
34
- feeInCents
35
- }
36
- GRAPHQL
37
- end
38
-
39
- let(:invoice_fragment_const) do
40
- stub_const('Graphlient::InvoiceFragment', invoice_fragment)
41
- end
42
-
43
- let(:query) do
44
- invoice_fragment_const
45
- client.parse do
46
- query do
47
- invoice(id: 10) do
48
- ___Graphlient__InvoiceFragment
49
- end
50
- end
51
- end
52
- end
53
-
54
- it '#parse' do
55
- expect(query).to be_a GraphQL::Client::OperationDefinition
56
- end
57
-
58
- it '#execute' do
59
- response = client.execute(query)
60
- invoice = response.data.invoice
61
- fragment = invoice_fragment.new(invoice)
62
- expect(fragment.id).to eq '10'
63
- end
64
- end
65
- end
66
-
67
- context 'parameterized query' do
68
- let(:query) do
69
- client.parse do
70
- query(some_id: :int) do
71
- invoice(id: :some_id) do
72
- id
73
- feeInCents
74
- end
75
- end
76
- end
77
- end
78
-
79
- it '#parse' do
80
- expect(query).to be_a GraphQL::Client::OperationDefinition
81
- end
82
-
83
- it '#execute' do
84
- response = client.execute(query, some_id: 42)
85
- invoice = response.data.invoice
86
- expect(invoice.id).to eq '42'
87
- expect(invoice.fee_in_cents).to eq 20_000
88
- end
89
-
90
- it '#execute without variables' do
91
- response = client.execute(query)
92
- invoice = response.data.invoice
93
- expect(invoice).to be_nil
94
- end
95
- end
96
-
97
- context 'parameterized GRAPHQL query' do
98
- let(:query) do
99
- <<-GRAPHQL
100
- query($id: Int) {
101
- invoice(id: $id) {
102
- id
103
- feeInCents
104
- }
105
- }
106
- GRAPHQL
107
- end
108
-
109
- let(:not_null_query) do
110
- <<-GRAPHQL
111
- query($id: Int) {
112
- notNullInvoice(id: $id) {
113
- id
114
- feeInCents
115
- }
116
- }
117
- GRAPHQL
118
- end
119
-
120
- let(:execution_error_query) do
121
- <<-GRAPHQL
122
- query($id: Int) {
123
- executionErrorInvoice(id: $id) {
124
- id
125
- feeInCents
126
- }
127
- }
128
- GRAPHQL
129
- end
130
-
131
- let(:partial_success_query) do
132
- <<-GRAPHQL
133
- query {
134
- someInvoices {
135
- id
136
- feeInCents
137
- createdAt
138
- }
139
- }
140
- GRAPHQL
141
- end
142
-
143
- it '#execute' do
144
- response = client.execute(query, id: 42)
145
- invoice = response.data.invoice
146
- expect(invoice.id).to eq '42'
147
- expect(invoice.fee_in_cents).to eq 20_000
148
- end
149
-
150
- it 'fails when wrong input type' do
151
- expect do
152
- client.execute(query, id: '42')
153
- end.to raise_error Graphlient::Errors::GraphQLError do |e|
154
- expect(e.to_s).to eq 'Variable $id of type Int was provided invalid value'
155
- end
156
- end
157
-
158
- it 'fails on an execution error' do
159
- expect do
160
- client.execute(execution_error_query, id: 42)
161
- end.to raise_error Graphlient::Errors::ExecutionError do |e|
162
- expect(e.to_s).to eq 'executionErrorInvoice: Execution Error'
163
- end
164
- end
165
-
166
- it 'fails with proper error message' do
167
- expect do
168
- client.execute(not_null_query, id: 42)
169
- end.to raise_error Graphlient::Errors::GraphQLError do |e|
170
- expect(e.to_s).to eq 'Cannot return null for non-nullable field Query.notNullInvoice'
171
- end
172
- end
173
-
174
- it 'fails with access to the response' do
175
- expect do
176
- client.execute(not_null_query, id: 42)
177
- end.to raise_error Graphlient::Errors::GraphQLError do |e|
178
- expect(e.response).to be_a GraphQL::Client::Response
179
- end
180
- end
181
-
182
- it 'fails with a partial error response' do
183
- expect do
184
- client.execute(partial_success_query)
185
- end.to raise_error Graphlient::Errors::ExecutionError do |e|
186
- expect(e.response).to be_a GraphQL::Client::Response
187
- end
188
- end
189
- end
190
-
191
- context 'non-parameterized query' do
192
- let(:query) do
193
- <<-GRAPHQL
194
- query($someId: Int) {
195
- invoices(id: $someId) {
196
- id
197
- feeInCents
198
- }
199
- }
200
- GRAPHQL
201
- end
202
- it 'fails client-side on invalid schema' do
203
- expect do
204
- client.execute(query, some_id: 'NASDASASD')
205
- end.to raise_error Graphlient::Errors::ClientError do |e|
206
- expect(e.to_s).to eq "Field 'invoices' doesn't exist on type 'Query'"
207
- end
208
- end
209
- end
210
- end
211
-
212
- describe '#query' do
213
- context 'non-parameterized query' do
214
- it 'fails client-side on invalid schema' do
215
- expect do
216
- client.query do
217
- query do
218
- invoices(id: 10) do
219
- id
220
- feeInCents
221
- end
222
- end
223
- end
224
- end.to raise_error Graphlient::Errors::ClientError do |e|
225
- expect(e.to_s).to eq "Field 'invoices' doesn't exist on type 'Query'"
226
- end
227
- end
228
-
229
- it 'returns a response from a query' do
230
- response = client.query do
231
- query do
232
- invoice(id: 10) do
233
- id
234
- feeInCents
235
- end
236
- end
237
- end
238
-
239
- invoice = response.data.invoice
240
- expect(invoice.id).to eq '10'
241
- expect(invoice.fee_in_cents).to eq 20_000
242
- end
243
-
244
- it 'returns a response from a GRAPHQL query' do
245
- response = client.query <<-GRAPHQL
246
- query {
247
- invoice(id: 10) {
248
- id
249
- feeInCents
250
- }
251
- }
252
- GRAPHQL
253
-
254
- invoice = response.data.invoice
255
- expect(invoice.id).to eq '10'
256
- expect(invoice.fee_in_cents).to eq 20_000
257
- end
258
-
259
- it 'returns a response from a mutation' do
260
- response = client.query do
261
- mutation do
262
- createInvoice(input: { feeInCents: 12_345 }) do
263
- invoice do
264
- id
265
- feeInCents
266
- end
267
- errors
268
- end
269
- end
270
- end
271
-
272
- invoice = response.data.create_invoice.invoice
273
- expect(invoice.id).to eq '1231'
274
- expect(invoice.fee_in_cents).to eq 12_345
275
- end
276
- end
277
-
278
- context 'parameterized query' do
279
- it 'fails when missing input' do
280
- expect do
281
- client.query do
282
- mutation(input: :CreateInvoiceInput!) do
283
- createInvoice(input: :input) do
284
- invoice do
285
- id
286
- feeInCents
287
- end
288
- errors
289
- end
290
- end
291
- end
292
- end.to raise_error Graphlient::Errors::GraphQLError,
293
- 'Variable $input of type CreateInvoiceInput! was provided invalid value'
294
- end
295
-
296
- it 'returns a response from a query' do
297
- response = client.query(id: 42) do
298
- query(id: :int) do
299
- invoice(id: :id) do
300
- id
301
- feeInCents
302
- end
303
- end
304
- end
305
-
306
- invoice = response.data.invoice
307
- expect(invoice.id).to eq '42'
308
- expect(invoice.fee_in_cents).to eq 20_000
309
- end
310
-
311
- it 'executes the mutation' do
312
- response = client.query(input: { feeInCents: 12_345 }) do
313
- mutation(input: :CreateInvoiceInput!) do
314
- createInvoice(input: :input) do
315
- invoice do
316
- id
317
- feeInCents
318
- end
319
- errors
320
- end
321
- end
322
- end
323
- invoice = response.data.create_invoice.invoice
324
- expect(invoice.id).to eq '1231'
325
- expect(invoice.fee_in_cents).to eq 12_345
326
- end
327
-
328
- it 'fails when mutation missing a field' do
329
- expect do
330
- client.query(input: {}) do
331
- mutation(input: :CreateInvoiceInput!) do
332
- createInvoice(input: :input) do
333
- invoice do
334
- id
335
- feeInCents
336
- end
337
- errors
338
- end
339
- end
340
- end
341
- end.to raise_error Graphlient::Errors::GraphQLError,
342
- 'Variable $input of type CreateInvoiceInput! was provided invalid value for feeInCents (Expected value to not be null)'
343
- end
344
- end
345
- end
346
- end
1
+ require 'spec_helper'
2
+
3
+ describe Graphlient::Client do
4
+ include_context 'Dummy Client'
5
+
6
+ describe 'parse and execute' do
7
+ context 'non-parameterized query' do
8
+ let(:query) do
9
+ client.parse do
10
+ query do
11
+ invoice(id: 10) do
12
+ id
13
+ feeInCents
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ it '#parse' do
20
+ expect(query).to be_a GraphQL::Client::OperationDefinition
21
+ end
22
+
23
+ it '#execute' do
24
+ response = client.execute(query)
25
+ invoice = response.data.invoice
26
+ expect(invoice.id).to eq '10'
27
+ end
28
+
29
+ context 'with fragment' do
30
+ let(:invoice_fragment) do
31
+ client.parse <<~'GRAPHQL'
32
+ fragment on Invoice {
33
+ id
34
+ feeInCents
35
+ }
36
+ GRAPHQL
37
+ end
38
+
39
+ let(:invoice_fragment_const) do
40
+ stub_const('Graphlient::InvoiceFragment', invoice_fragment)
41
+ end
42
+
43
+ let(:query) do
44
+ invoice_fragment_const
45
+ client.parse do
46
+ query do
47
+ invoice(id: 10) do
48
+ ___Graphlient__InvoiceFragment
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ it '#parse' do
55
+ expect(query).to be_a GraphQL::Client::OperationDefinition
56
+ end
57
+
58
+ it '#execute' do
59
+ response = client.execute(query)
60
+ invoice = response.data.invoice
61
+ fragment = invoice_fragment.new(invoice)
62
+ expect(fragment.id).to eq '10'
63
+ end
64
+ end
65
+ end
66
+
67
+ context 'parameterized query' do
68
+ let(:query) do
69
+ client.parse do
70
+ query(some_id: :int) do
71
+ invoice(id: :some_id) do
72
+ id
73
+ feeInCents
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+ it '#parse' do
80
+ expect(query).to be_a GraphQL::Client::OperationDefinition
81
+ end
82
+
83
+ it '#execute' do
84
+ response = client.execute(query, some_id: 42)
85
+ invoice = response.data.invoice
86
+ expect(invoice.id).to eq '42'
87
+ expect(invoice.fee_in_cents).to eq 20_000
88
+ end
89
+
90
+ it '#execute without variables' do
91
+ response = client.execute(query)
92
+ invoice = response.data.invoice
93
+ expect(invoice).to be_nil
94
+ end
95
+
96
+ context 'with directive' do
97
+ let(:query) do
98
+ client.parse do
99
+ query(
100
+ some_id: :int,
101
+ skip_fee: :boolean!
102
+ ) do
103
+ invoice(id: :some_id) do
104
+ id
105
+ feeInCents _skip(if: :skip_fee)
106
+ end
107
+ end
108
+ end
109
+ end
110
+
111
+ it '#execute' do
112
+ response = client.execute(query, some_id: 42, skip_fee: true)
113
+ invoice = response.data.invoice
114
+ expect(invoice.id).to eq '42'
115
+ expect(invoice.fee_in_cents).to eq nil
116
+ end
117
+ end
118
+ end
119
+
120
+ context 'parameterized GRAPHQL query' do
121
+ let(:query) do
122
+ <<-GRAPHQL
123
+ query($id: Int) {
124
+ invoice(id: $id) {
125
+ id
126
+ feeInCents
127
+ }
128
+ }
129
+ GRAPHQL
130
+ end
131
+
132
+ let(:not_null_query) do
133
+ <<-GRAPHQL
134
+ query($id: Int) {
135
+ notNullInvoice(id: $id) {
136
+ id
137
+ feeInCents
138
+ }
139
+ }
140
+ GRAPHQL
141
+ end
142
+
143
+ let(:execution_error_query) do
144
+ <<-GRAPHQL
145
+ query($id: Int) {
146
+ executionErrorInvoice(id: $id) {
147
+ id
148
+ feeInCents
149
+ }
150
+ }
151
+ GRAPHQL
152
+ end
153
+
154
+ let(:partial_success_query) do
155
+ <<-GRAPHQL
156
+ query {
157
+ someInvoices {
158
+ id
159
+ feeInCents
160
+ createdAt
161
+ }
162
+ }
163
+ GRAPHQL
164
+ end
165
+
166
+ it '#execute' do
167
+ response = client.execute(query, id: 42)
168
+ invoice = response.data.invoice
169
+ expect(invoice.id).to eq '42'
170
+ expect(invoice.fee_in_cents).to eq 20_000
171
+ end
172
+
173
+ it 'fails when wrong input type' do
174
+ expect do
175
+ client.execute(query, id: '42')
176
+ end.to raise_error Graphlient::Errors::GraphQLError do |e|
177
+ expect(e.to_s).to eq 'Variable $id of type Int was provided invalid value'
178
+ end
179
+ end
180
+
181
+ it 'fails on an execution error' do
182
+ expect do
183
+ client.execute(execution_error_query, id: 42)
184
+ end.to raise_error Graphlient::Errors::ExecutionError do |e|
185
+ expect(e.to_s).to eq 'executionErrorInvoice: Execution Error'
186
+ end
187
+ end
188
+
189
+ it 'fails with proper error message' do
190
+ expect do
191
+ client.execute(not_null_query, id: 42)
192
+ end.to raise_error Graphlient::Errors::GraphQLError do |e|
193
+ expect(e.to_s).to eq 'Cannot return null for non-nullable field Query.notNullInvoice'
194
+ end
195
+ end
196
+
197
+ it 'fails with access to the response' do
198
+ expect do
199
+ client.execute(not_null_query, id: 42)
200
+ end.to raise_error Graphlient::Errors::GraphQLError do |e|
201
+ expect(e.response).to be_a GraphQL::Client::Response
202
+ end
203
+ end
204
+
205
+ it 'fails with a partial error response' do
206
+ expect do
207
+ client.execute(partial_success_query)
208
+ end.to raise_error Graphlient::Errors::ExecutionError do |e|
209
+ expect(e.response).to be_a GraphQL::Client::Response
210
+ end
211
+ end
212
+ end
213
+
214
+ context 'non-parameterized query' do
215
+ let(:query) do
216
+ <<-GRAPHQL
217
+ query($someId: Int) {
218
+ invoices(id: $someId) {
219
+ id
220
+ feeInCents
221
+ }
222
+ }
223
+ GRAPHQL
224
+ end
225
+ it 'fails client-side on invalid schema' do
226
+ expect do
227
+ client.execute(query, some_id: 'NASDASASD')
228
+ end.to raise_error Graphlient::Errors::ClientError do |e|
229
+ expect(e.to_s).to eq "Field 'invoices' doesn't exist on type 'Query'"
230
+ end
231
+ end
232
+ end
233
+ end
234
+
235
+ describe '#query' do
236
+ context 'non-parameterized query' do
237
+ it 'fails client-side on invalid schema' do
238
+ expect do
239
+ client.query do
240
+ query do
241
+ invoices(id: 10) do
242
+ id
243
+ feeInCents
244
+ end
245
+ end
246
+ end
247
+ end.to raise_error Graphlient::Errors::ClientError do |e|
248
+ expect(e.to_s).to eq "Field 'invoices' doesn't exist on type 'Query'"
249
+ end
250
+ end
251
+
252
+ it 'returns a response from a query' do
253
+ response = client.query do
254
+ query do
255
+ invoice(id: 10) do
256
+ id
257
+ feeInCents
258
+ end
259
+ end
260
+ end
261
+
262
+ invoice = response.data.invoice
263
+ expect(invoice.id).to eq '10'
264
+ expect(invoice.fee_in_cents).to eq 20_000
265
+ end
266
+
267
+ it 'returns a response from a GRAPHQL query' do
268
+ response = client.query <<-GRAPHQL
269
+ query {
270
+ invoice(id: 10) {
271
+ id
272
+ feeInCents
273
+ }
274
+ }
275
+ GRAPHQL
276
+
277
+ invoice = response.data.invoice
278
+ expect(invoice.id).to eq '10'
279
+ expect(invoice.fee_in_cents).to eq 20_000
280
+ end
281
+
282
+ it 'returns a response from a mutation' do
283
+ response = client.query do
284
+ mutation do
285
+ createInvoice(input: { feeInCents: 12_345 }) do
286
+ invoice do
287
+ id
288
+ feeInCents
289
+ end
290
+ errors
291
+ end
292
+ end
293
+ end
294
+
295
+ invoice = response.data.create_invoice.invoice
296
+ expect(invoice.id).to eq '1231'
297
+ expect(invoice.fee_in_cents).to eq 12_345
298
+ end
299
+ end
300
+
301
+ context 'parameterized query' do
302
+ it 'fails when missing input' do
303
+ expect do
304
+ client.query do
305
+ mutation(input: :CreateInvoiceInput!) do
306
+ createInvoice(input: :input) do
307
+ invoice do
308
+ id
309
+ feeInCents
310
+ end
311
+ errors
312
+ end
313
+ end
314
+ end
315
+ end.to raise_error Graphlient::Errors::GraphQLError,
316
+ 'Variable $input of type CreateInvoiceInput! was provided invalid value'
317
+ end
318
+
319
+ it 'returns a response from a query' do
320
+ response = client.query(id: 42) do
321
+ query(id: :int) do
322
+ invoice(id: :id) do
323
+ id
324
+ feeInCents
325
+ end
326
+ end
327
+ end
328
+
329
+ invoice = response.data.invoice
330
+ expect(invoice.id).to eq '42'
331
+ expect(invoice.fee_in_cents).to eq 20_000
332
+ end
333
+
334
+ it 'executes the mutation' do
335
+ response = client.query(input: { feeInCents: 12_345 }) do
336
+ mutation(input: :CreateInvoiceInput!) do
337
+ createInvoice(input: :input) do
338
+ invoice do
339
+ id
340
+ feeInCents
341
+ end
342
+ errors
343
+ end
344
+ end
345
+ end
346
+ invoice = response.data.create_invoice.invoice
347
+ expect(invoice.id).to eq '1231'
348
+ expect(invoice.fee_in_cents).to eq 12_345
349
+ end
350
+
351
+ it 'fails when mutation missing a field' do
352
+ expect do
353
+ client.query(input: {}) do
354
+ mutation(input: :CreateInvoiceInput!) do
355
+ createInvoice(input: :input) do
356
+ invoice do
357
+ id
358
+ feeInCents
359
+ end
360
+ errors
361
+ end
362
+ end
363
+ end
364
+ end.to raise_error Graphlient::Errors::GraphQLError,
365
+ 'Variable $input of type CreateInvoiceInput! was provided invalid value for feeInCents (Expected value to not be null)'
366
+ end
367
+ end
368
+ end
369
+ end