boltless 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +3 -3
- data/Gemfile +15 -0
- data/Makefile +13 -1
- data/lib/boltless/extensions/utilities.rb +4 -4
- data/lib/boltless/version.rb +1 -1
- data/spec/boltless/extensions/configuration_handling_spec.rb +1 -1
- data/spec/boltless/extensions/connection_pool_spec.rb +6 -6
- data/spec/boltless/extensions/operations_spec.rb +9 -9
- data/spec/boltless/extensions/transactions_spec.rb +22 -22
- data/spec/boltless/extensions/utilities_spec.rb +61 -61
- data/spec/boltless/request_spec.rb +18 -20
- data/spec/boltless/result_row_spec.rb +7 -7
- data/spec/boltless/result_spec.rb +3 -3
- data/spec/boltless/statement_collector_spec.rb +2 -2
- data/spec/boltless/transaction_spec.rb +32 -32
- metadata +3 -185
@@ -13,7 +13,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
13
13
|
let(:replacements) { {} }
|
14
14
|
|
15
15
|
it 'returns the untouched input string' do
|
16
|
-
expect(action).to
|
16
|
+
expect(action).to eql(cypher)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -31,7 +31,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
31
31
|
let(:replacements) { { subject: 'User' } }
|
32
32
|
|
33
33
|
it 'returns the processed input string' do
|
34
|
-
expect(action).to
|
34
|
+
expect(action).to eql('CREATE (n:User)')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -40,7 +40,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
40
40
|
let(:replacements) { { label: :user } }
|
41
41
|
|
42
42
|
it 'returns the processed input string' do
|
43
|
-
expect(action).to
|
43
|
+
expect(action).to eql('CREATE (n:User)')
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -49,7 +49,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
49
49
|
let(:replacements) { { subject_label: :user } }
|
50
50
|
|
51
51
|
it 'returns the processed input string' do
|
52
|
-
expect(action).to
|
52
|
+
expect(action).to eql('CREATE (n:User)')
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -58,7 +58,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
58
58
|
let(:replacements) { { subject_labels: %i[user customer] } }
|
59
59
|
|
60
60
|
it 'returns the processed input string' do
|
61
|
-
expect(action).to
|
61
|
+
expect(action).to eql('CREATE (n:Customer:User)')
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -67,7 +67,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
67
67
|
let(:replacements) { { type: :read } }
|
68
68
|
|
69
69
|
it 'returns the processed input string' do
|
70
|
-
expect(action).to
|
70
|
+
expect(action).to eql('CREATE (a)-[:READ]->(b)')
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -76,7 +76,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
76
76
|
let(:replacements) { { predicate_type: :read } }
|
77
77
|
|
78
78
|
it 'returns the processed input string' do
|
79
|
-
expect(action).to
|
79
|
+
expect(action).to eql('CREATE (a)-[:READ]->(b)')
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -85,7 +85,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
85
85
|
let(:replacements) { { predicate_types: %i[read write] } }
|
86
86
|
|
87
87
|
it 'returns the processed input string' do
|
88
|
-
expect(action).to
|
88
|
+
expect(action).to eql('CREATE (a)-[:READ|WRITE]->(b)')
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -94,7 +94,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
94
94
|
let(:replacements) { { name_str: 'Klaus' } }
|
95
95
|
|
96
96
|
it 'returns the processed input string' do
|
97
|
-
expect(action).to
|
97
|
+
expect(action).to eql('CREATE (n:User { name: "Klaus" })')
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -104,7 +104,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
104
104
|
|
105
105
|
it 'returns the processed input string' do
|
106
106
|
expect(action).to \
|
107
|
-
|
107
|
+
eql('CREATE (n:User { states: ["active", "locked"] })')
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -120,7 +120,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
120
120
|
|
121
121
|
it 'returns the processed input string' do
|
122
122
|
expect(action).to \
|
123
|
-
|
123
|
+
eql('CREATE (n:User)')
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
@@ -129,69 +129,69 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
129
129
|
context 'with a single string' do
|
130
130
|
it 'returns the escaped string' do
|
131
131
|
expect(described_class.prepare_label('user')).to \
|
132
|
-
|
132
|
+
eql('User')
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
136
|
context 'with multiple strings' do
|
137
137
|
it 'returns the escaped string' do
|
138
138
|
expect(described_class.prepare_label('user', 'payment')).to \
|
139
|
-
|
139
|
+
eql('Payment:User')
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
143
|
context 'with nested strings' do
|
144
144
|
it 'returns the escaped string' do
|
145
145
|
res = described_class.prepare_label(['user'], [['payment']], 'session')
|
146
|
-
expect(res).to
|
146
|
+
expect(res).to eql('Payment:Session:User')
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
150
|
context 'with some nasty strings' do
|
151
151
|
it 'returns the escaped string' do
|
152
152
|
expect(described_class.prepare_label('userv2', 'user+v2')).to \
|
153
|
-
|
153
|
+
eql('Userv2:`User+v2`')
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
157
|
context 'with an underscored string' do
|
158
158
|
it 'returns the escaped string' do
|
159
159
|
expect(described_class.prepare_label('payment_mandate')).to \
|
160
|
-
|
160
|
+
eql('PaymentMandate')
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
164
|
context 'with an camel-cased string' do
|
165
165
|
it 'returns the escaped string' do
|
166
166
|
expect(described_class.prepare_label('paymentMandate')).to \
|
167
|
-
|
167
|
+
eql('PaymentMandate')
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
171
|
context 'with an pascal-cased string' do
|
172
172
|
it 'returns the escaped string' do
|
173
173
|
expect(described_class.prepare_label('PaymentMandate')).to \
|
174
|
-
|
174
|
+
eql('PaymentMandate')
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
178
|
context 'with an underscored symbol' do
|
179
179
|
it 'returns the escaped string' do
|
180
180
|
expect(described_class.prepare_label(:payment_mandate)).to \
|
181
|
-
|
181
|
+
eql('PaymentMandate')
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
185
|
context 'with an kabab-cased string' do
|
186
186
|
it 'returns the escaped string' do
|
187
187
|
expect(described_class.prepare_label('payment-mandate')).to \
|
188
|
-
|
188
|
+
eql('PaymentMandate')
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
192
|
context 'with an boolean (false)' do
|
193
193
|
it 'returns the escaped string' do
|
194
|
-
expect(described_class.prepare_label(false)).to
|
194
|
+
expect(described_class.prepare_label(false)).to eql('False')
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
@@ -207,7 +207,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
207
207
|
res = described_class.prepare_label(
|
208
208
|
[:a], [true, [false, ['"nice"', "o'neil"], nil]]
|
209
209
|
)
|
210
|
-
expect(res).to
|
210
|
+
expect(res).to eql("A:False:True:`\"nice\"`:`O'neil`")
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
@@ -215,7 +215,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
215
215
|
it 'returns the escaped string' do
|
216
216
|
set = Set[:user, :payment, :session, true]
|
217
217
|
expect(described_class.prepare_label(set)).to \
|
218
|
-
|
218
|
+
eql('Payment:Session:True:User')
|
219
219
|
end
|
220
220
|
end
|
221
221
|
end
|
@@ -224,69 +224,69 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
224
224
|
context 'with a single string' do
|
225
225
|
it 'returns the escaped string' do
|
226
226
|
expect(described_class.prepare_type('read')).to \
|
227
|
-
|
227
|
+
eql('READ')
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
231
231
|
context 'with multiple strings' do
|
232
232
|
it 'returns the escaped string' do
|
233
233
|
expect(described_class.prepare_type('read', 'write')).to \
|
234
|
-
|
234
|
+
eql('READ|WRITE')
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
238
|
context 'with nested strings' do
|
239
239
|
it 'returns the escaped string' do
|
240
240
|
res = described_class.prepare_type(['read'], [['write']], 'delete')
|
241
|
-
expect(res).to
|
241
|
+
expect(res).to eql('DELETE|READ|WRITE')
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
245
245
|
context 'with some nasty strings' do
|
246
246
|
it 'returns the escaped string' do
|
247
247
|
expect(described_class.prepare_type('userv2', 'user+v2')).to \
|
248
|
-
|
248
|
+
eql('USERV2|`USER+V2`')
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
252
|
context 'with an underscored string' do
|
253
253
|
it 'returns the escaped string' do
|
254
254
|
expect(described_class.prepare_type('read_write')).to \
|
255
|
-
|
255
|
+
eql('READ_WRITE')
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
259
259
|
context 'with an camel-cased string' do
|
260
260
|
it 'returns the escaped string' do
|
261
261
|
expect(described_class.prepare_type('readWrite')).to \
|
262
|
-
|
262
|
+
eql('READ_WRITE')
|
263
263
|
end
|
264
264
|
end
|
265
265
|
|
266
266
|
context 'with an pascal-cased string' do
|
267
267
|
it 'returns the escaped string' do
|
268
268
|
expect(described_class.prepare_type('ReadWrite')).to \
|
269
|
-
|
269
|
+
eql('READ_WRITE')
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
273
273
|
context 'with an underscored symbol' do
|
274
274
|
it 'returns the escaped string' do
|
275
275
|
expect(described_class.prepare_type(:read_write)).to \
|
276
|
-
|
276
|
+
eql('READ_WRITE')
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
280
|
context 'with an kabab-cased string' do
|
281
281
|
it 'returns the escaped string' do
|
282
282
|
expect(described_class.prepare_type('read-write')).to \
|
283
|
-
|
283
|
+
eql('READ_WRITE')
|
284
284
|
end
|
285
285
|
end
|
286
286
|
|
287
287
|
context 'with an boolean (false)' do
|
288
288
|
it 'returns the escaped string' do
|
289
|
-
expect(described_class.prepare_type(false)).to
|
289
|
+
expect(described_class.prepare_type(false)).to eql('FALSE')
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
@@ -302,14 +302,14 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
302
302
|
res = described_class.prepare_type(
|
303
303
|
[:a], [true, [false, ['"nice"', "o'neil"], nil], 1], 12.14
|
304
304
|
)
|
305
|
-
expect(res).to
|
305
|
+
expect(res).to eql("1|A|FALSE|TRUE|`\"NICE\"`|`12.14`|`O'NEIL`")
|
306
306
|
end
|
307
307
|
end
|
308
308
|
|
309
309
|
context 'with a set' do
|
310
310
|
it 'returns the escaped string' do
|
311
311
|
set = Set[:a, :b, :c, 1]
|
312
|
-
expect(described_class.prepare_type(set)).to
|
312
|
+
expect(described_class.prepare_type(set)).to eql('1|A|B|C')
|
313
313
|
end
|
314
314
|
end
|
315
315
|
end
|
@@ -318,45 +318,45 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
318
318
|
context 'with a single string' do
|
319
319
|
it 'returns the escaped string' do
|
320
320
|
expect(described_class.prepare_string('super "cool" string')).to \
|
321
|
-
|
321
|
+
eql('"super \"cool\" string"')
|
322
322
|
end
|
323
323
|
end
|
324
324
|
|
325
325
|
context 'with multiple strings' do
|
326
326
|
it 'returns the escaped string' do
|
327
327
|
expect(described_class.prepare_string('a', 'b')).to \
|
328
|
-
|
328
|
+
eql('"a", "b"')
|
329
329
|
end
|
330
330
|
end
|
331
331
|
|
332
332
|
context 'with nested strings' do
|
333
333
|
it 'returns the escaped string' do
|
334
334
|
expect(described_class.prepare_string(['a'], [['b']], 'c')).to \
|
335
|
-
|
335
|
+
eql('"a", "b", "c"')
|
336
336
|
end
|
337
337
|
end
|
338
338
|
|
339
339
|
context 'with an integer' do
|
340
340
|
it 'returns the escaped string' do
|
341
|
-
expect(described_class.prepare_string(1)).to
|
341
|
+
expect(described_class.prepare_string(1)).to eql('"1"')
|
342
342
|
end
|
343
343
|
end
|
344
344
|
|
345
345
|
context 'with an boolean (true)' do
|
346
346
|
it 'returns the escaped string' do
|
347
|
-
expect(described_class.prepare_string(true)).to
|
347
|
+
expect(described_class.prepare_string(true)).to eql('"true"')
|
348
348
|
end
|
349
349
|
end
|
350
350
|
|
351
351
|
context 'with an boolean (false)' do
|
352
352
|
it 'returns the escaped string' do
|
353
|
-
expect(described_class.prepare_string(false)).to
|
353
|
+
expect(described_class.prepare_string(false)).to eql('"false"')
|
354
354
|
end
|
355
355
|
end
|
356
356
|
|
357
357
|
context 'with nil' do
|
358
358
|
it 'returns the escaped string' do
|
359
|
-
expect(described_class.prepare_string(nil)).to
|
359
|
+
expect(described_class.prepare_string(nil)).to eql('""')
|
360
360
|
end
|
361
361
|
end
|
362
362
|
|
@@ -366,7 +366,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
366
366
|
[:a], [true, [false, ['"nice"', "o'neil"], nil], 1], 12.14
|
367
367
|
)
|
368
368
|
expect(res).to \
|
369
|
-
|
369
|
+
eql('"a", "true", "false", "\"nice\"", "o\'neil", "1", "12.14"')
|
370
370
|
end
|
371
371
|
end
|
372
372
|
|
@@ -374,7 +374,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
374
374
|
it 'returns the escaped string' do
|
375
375
|
set = Set[:a, :b, :c, 1]
|
376
376
|
expect(described_class.prepare_string(set)).to \
|
377
|
-
|
377
|
+
eql('"a", "b", "c", "1"')
|
378
378
|
end
|
379
379
|
end
|
380
380
|
end
|
@@ -400,7 +400,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
400
400
|
let(:obj) { 'test' }
|
401
401
|
|
402
402
|
it 'returns the Cypher options representation' do
|
403
|
-
expect(action).to
|
403
|
+
expect(action).to eql(%('test'))
|
404
404
|
end
|
405
405
|
end
|
406
406
|
|
@@ -408,7 +408,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
408
408
|
let(:obj) { ['test', 1.9235, 2, true, nil] }
|
409
409
|
|
410
410
|
it 'returns the Cypher options representation' do
|
411
|
-
expect(action).to
|
411
|
+
expect(action).to eql(%([ 'test', 1.9235, 2, true ]))
|
412
412
|
end
|
413
413
|
end
|
414
414
|
|
@@ -416,13 +416,13 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
416
416
|
let(:obj) { { symbol: true, 'string' => 1.234 } }
|
417
417
|
|
418
418
|
it 'returns the Cypher options representation' do
|
419
|
-
expect(action).to
|
419
|
+
expect(action).to eql(%({ `symbol`: true, `string`: 1.234 }))
|
420
420
|
end
|
421
421
|
end
|
422
422
|
|
423
423
|
context 'with a complex nested structure' do
|
424
424
|
it 'returns the Cypher options representation' do
|
425
|
-
expect(action).to
|
425
|
+
expect(action).to eql(cypher_opts)
|
426
426
|
end
|
427
427
|
end
|
428
428
|
end
|
@@ -435,7 +435,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
435
435
|
let(:args) { {} }
|
436
436
|
|
437
437
|
it 'returns the untouched input string' do
|
438
|
-
expect(action).to
|
438
|
+
expect(action).to eql(cypher)
|
439
439
|
end
|
440
440
|
end
|
441
441
|
|
@@ -444,7 +444,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
444
444
|
let(:args) { {} }
|
445
445
|
|
446
446
|
it 'returns the untouched input string' do
|
447
|
-
expect(action).to
|
447
|
+
expect(action).to eql(cypher)
|
448
448
|
end
|
449
449
|
end
|
450
450
|
|
@@ -453,7 +453,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
453
453
|
let(:args) { { name: 'Peter' } }
|
454
454
|
|
455
455
|
it 'returns the resolved string' do
|
456
|
-
expect(action).to
|
456
|
+
expect(action).to eql('CREATE (n:User { name: "Peter" })')
|
457
457
|
end
|
458
458
|
end
|
459
459
|
|
@@ -463,7 +463,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
463
463
|
|
464
464
|
it 'returns the resolved string' do
|
465
465
|
expect(action).to \
|
466
|
-
|
466
|
+
eql('CREATE (n:User { name: $name, email: "peter@example.com" })')
|
467
467
|
end
|
468
468
|
end
|
469
469
|
end
|
@@ -475,7 +475,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
475
475
|
let(:cypher) { 'BEGIN' }
|
476
476
|
|
477
477
|
it 'returns magenta' do
|
478
|
-
expect(action).to
|
478
|
+
expect(action).to be(:magenta)
|
479
479
|
end
|
480
480
|
end
|
481
481
|
|
@@ -483,7 +483,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
483
483
|
let(:cypher) { 'CREATE (n:User { name: $name })' }
|
484
484
|
|
485
485
|
it 'returns green' do
|
486
|
-
expect(action).to
|
486
|
+
expect(action).to be(:green)
|
487
487
|
end
|
488
488
|
end
|
489
489
|
|
@@ -491,7 +491,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
491
491
|
let(:cypher) { 'MERGE (n:User { name: $name })' }
|
492
492
|
|
493
493
|
it 'returns yellow' do
|
494
|
-
expect(action).to
|
494
|
+
expect(action).to be(:yellow)
|
495
495
|
end
|
496
496
|
end
|
497
497
|
|
@@ -499,7 +499,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
499
499
|
let(:cypher) { 'MATCH (n:User { name: $name }) SET n.email = $email' }
|
500
500
|
|
501
501
|
it 'returns yellow' do
|
502
|
-
expect(action).to
|
502
|
+
expect(action).to be(:yellow)
|
503
503
|
end
|
504
504
|
end
|
505
505
|
|
@@ -507,7 +507,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
507
507
|
let(:cypher) { 'MATCH (n:User { name: $name }) DELETE n' }
|
508
508
|
|
509
509
|
it 'returns red' do
|
510
|
-
expect(action).to
|
510
|
+
expect(action).to be(:red)
|
511
511
|
end
|
512
512
|
end
|
513
513
|
|
@@ -515,7 +515,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
515
515
|
let(:cypher) { 'MATCH (n:User { name: $name }) REMOVE n.email' }
|
516
516
|
|
517
517
|
it 'returns red' do
|
518
|
-
expect(action).to
|
518
|
+
expect(action).to be(:red)
|
519
519
|
end
|
520
520
|
end
|
521
521
|
|
@@ -523,7 +523,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
523
523
|
let(:cypher) { 'COMMIT' }
|
524
524
|
|
525
525
|
it 'returns green' do
|
526
|
-
expect(action).to
|
526
|
+
expect(action).to be(:green)
|
527
527
|
end
|
528
528
|
end
|
529
529
|
|
@@ -531,7 +531,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
531
531
|
let(:cypher) { 'ROLLBACK' }
|
532
532
|
|
533
533
|
it 'returns red' do
|
534
|
-
expect(action).to
|
534
|
+
expect(action).to be(:red)
|
535
535
|
end
|
536
536
|
end
|
537
537
|
|
@@ -539,7 +539,7 @@ RSpec.describe Boltless::Extensions::Utilities do
|
|
539
539
|
let(:cypher) { 'MATCH (n:User { name: $name }) RETURN n.email' }
|
540
540
|
|
541
541
|
it 'returns light blue' do
|
542
|
-
expect(action).to
|
542
|
+
expect(action).to be(:light_blue)
|
543
543
|
end
|
544
544
|
end
|
545
545
|
end
|
@@ -82,22 +82,22 @@ RSpec.describe Boltless::Request do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'returns 4 results' do
|
85
|
-
expect(action.count).to
|
85
|
+
expect(action.count).to be(4)
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'returns the expected results (first 3)' do
|
89
|
-
expect(action[0..2].map(&:count)).to all(
|
89
|
+
expect(action[0..2].map(&:count)).to all(eql(0))
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'returns the expected results (last)' do
|
93
|
-
expect(action.last.value).to
|
93
|
+
expect(action.last.value).to eql('Bernd')
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'does not write the data actually' do
|
97
97
|
count = instance.one_shot_transaction(
|
98
98
|
{ statement: 'MATCH (n:User) RETURN count(n)' }
|
99
99
|
).first.value
|
100
|
-
expect(count).to
|
100
|
+
expect(count).to be(0)
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -109,7 +109,7 @@ RSpec.describe Boltless::Request do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'returns an array with the converted statements' do
|
112
|
-
expect(action.call(['a', { a: true }], ['b', {}]).count).to
|
112
|
+
expect(action.call(['a', { a: true }], ['b', {}]).count).to be(2)
|
113
113
|
end
|
114
114
|
|
115
115
|
it 'returns an array of converted statement Hashes' do
|
@@ -184,8 +184,7 @@ RSpec.describe Boltless::Request do
|
|
184
184
|
let(:req_body) { { statements: statements }.to_json }
|
185
185
|
|
186
186
|
before do
|
187
|
-
allow(connection).to
|
188
|
-
allow(connection).to receive(:post).and_return(response)
|
187
|
+
allow(connection).to receive_messages(headers: connection, post: response)
|
189
188
|
end
|
190
189
|
|
191
190
|
context 'without statements' do
|
@@ -224,8 +223,7 @@ RSpec.describe Boltless::Request do
|
|
224
223
|
let(:body) { '{}' }
|
225
224
|
|
226
225
|
before do
|
227
|
-
allow(connection).to
|
228
|
-
allow(connection).to receive(:post).and_return(response)
|
226
|
+
allow(connection).to receive_messages(headers: connection, post: response)
|
229
227
|
end
|
230
228
|
|
231
229
|
it 'sets the correct access mode header' do
|
@@ -259,7 +257,7 @@ RSpec.describe Boltless::Request do
|
|
259
257
|
let(:headers) { { 'location' => 'http://neo4j:7474/db/neo4j/tx/3894' } }
|
260
258
|
|
261
259
|
it 'returns the correct transaction identifier' do
|
262
|
-
expect(action.call).to
|
260
|
+
expect(action.call).to be(3894)
|
263
261
|
end
|
264
262
|
end
|
265
263
|
|
@@ -492,7 +490,7 @@ RSpec.describe Boltless::Request do
|
|
492
490
|
end
|
493
491
|
|
494
492
|
it 'returns an empty array' do
|
495
|
-
expect(action).to
|
493
|
+
expect(action).to be_empty
|
496
494
|
end
|
497
495
|
end
|
498
496
|
|
@@ -614,7 +612,7 @@ RSpec.describe Boltless::Request do
|
|
614
612
|
|
615
613
|
it 'passes over the raw response body' do
|
616
614
|
Boltless.configuration.raw_response_handler = proc do |body, _res|
|
617
|
-
expect(body).to
|
615
|
+
expect(body).to eql('{"test":true}')
|
618
616
|
body
|
619
617
|
end
|
620
618
|
action
|
@@ -635,19 +633,19 @@ RSpec.describe Boltless::Request do
|
|
635
633
|
|
636
634
|
context 'with an Array' do
|
637
635
|
it 'returns the expected JSON representation' do
|
638
|
-
expect(action[[1, [2]]]).to
|
636
|
+
expect(action[[1, [2]]]).to eql('[1,[2]]')
|
639
637
|
end
|
640
638
|
end
|
641
639
|
|
642
640
|
context 'with a Hash' do
|
643
641
|
it 'returns the expected JSON representation' do
|
644
|
-
expect(action[{ a: { b: true } }]).to
|
642
|
+
expect(action[{ a: { b: true } }]).to eql('{"a":{"b":true}}')
|
645
643
|
end
|
646
644
|
end
|
647
645
|
|
648
646
|
context 'with a String' do
|
649
647
|
it 'returns the expected JSON representation' do
|
650
|
-
expect(action['test']).to
|
648
|
+
expect(action['test']).to eql('"test"')
|
651
649
|
end
|
652
650
|
end
|
653
651
|
end
|
@@ -690,7 +688,7 @@ RSpec.describe Boltless::Request do
|
|
690
688
|
end
|
691
689
|
|
692
690
|
it 'returns the result of the user block' do
|
693
|
-
expect(action.call).to
|
691
|
+
expect(action.call).to be(923)
|
694
692
|
end
|
695
693
|
|
696
694
|
it 'does not change the request counter' do
|
@@ -712,7 +710,7 @@ RSpec.describe Boltless::Request do
|
|
712
710
|
end
|
713
711
|
|
714
712
|
it 'returns the result of the user block' do
|
715
|
-
expect(action.call).to
|
713
|
+
expect(action.call).to be(923)
|
716
714
|
end
|
717
715
|
|
718
716
|
it 'change the request counter' do
|
@@ -777,7 +775,7 @@ RSpec.describe Boltless::Request do
|
|
777
775
|
end
|
778
776
|
|
779
777
|
it 'returns the result of the user block' do
|
780
|
-
expect(action.call).to
|
778
|
+
expect(action.call).to be(923)
|
781
779
|
end
|
782
780
|
|
783
781
|
it 'calls the logger twice' do
|
@@ -917,7 +915,7 @@ RSpec.describe Boltless::Request do
|
|
917
915
|
|
918
916
|
context 'with a single statement' do
|
919
917
|
it 'returns a string with a single line' do
|
920
|
-
expect(action.lines.count).to
|
918
|
+
expect(action.lines.count).to be(1)
|
921
919
|
end
|
922
920
|
|
923
921
|
it 'resolves the Cypher statement with the parameters' do
|
@@ -940,7 +938,7 @@ RSpec.describe Boltless::Request do
|
|
940
938
|
end
|
941
939
|
|
942
940
|
it 'returns a string with two lines' do
|
943
|
-
expect(action.lines.count).to
|
941
|
+
expect(action.lines.count).to be(2)
|
944
942
|
end
|
945
943
|
|
946
944
|
it 'resolves the Cypher statement with the parameters (1)' do
|