ashikawa-core 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.hound.yml +1 -1
- data/.travis.yml +1 -5
- data/CHANGELOG.md +13 -0
- data/README.md +2 -3
- data/config/reek.yml +1 -0
- data/lib/ashikawa-core/collection.rb +14 -1
- data/lib/ashikawa-core/connection.rb +1 -0
- data/lib/ashikawa-core/database.rb +46 -3
- data/lib/ashikawa-core/document.rb +14 -1
- data/lib/ashikawa-core/edge.rb +6 -1
- data/lib/ashikawa-core/edge_collection.rb +92 -0
- data/lib/ashikawa-core/error_response.rb +16 -0
- data/lib/ashikawa-core/exceptions/client_error/resource_not_found/collection_not_in_graph.rb +18 -0
- data/lib/ashikawa-core/exceptions/client_error/resource_not_found/graph_not_found.rb +18 -0
- data/lib/ashikawa-core/faraday_factory.rb +1 -1
- data/lib/ashikawa-core/graph.rb +222 -0
- data/lib/ashikawa-core/version.rb +11 -1
- data/lib/ashikawa-core/vertex_collection.rb +35 -0
- data/lib/ashikawa-core/x_arango_version.rb +26 -0
- data/spec/acceptance/graph_spec.rb +89 -0
- data/spec/acceptance/spec_helper.rb +15 -2
- data/spec/unit/collection_spec.rb +23 -8
- data/spec/unit/connection_spec.rb +47 -0
- data/spec/unit/database_spec.rb +111 -0
- data/spec/unit/document_spec.rb +16 -0
- data/spec/unit/edge_collection_spec.rb +105 -0
- data/spec/unit/edge_spec.rb +23 -0
- data/spec/unit/exception_spec.rb +12 -0
- data/spec/unit/faraday_factory_spec.rb +1 -0
- data/spec/unit/graph_spec.rb +270 -0
- data/spec/unit/vertex_collection_spec.rb +48 -0
- metadata +17 -3
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'unit/spec_helper'
|
3
|
+
require 'ashikawa-core/vertex_collection'
|
4
|
+
require 'ashikawa-core/graph'
|
5
|
+
require 'ashikawa-core/database'
|
6
|
+
|
7
|
+
describe Ashikawa::Core::VertexCollection do
|
8
|
+
let(:database) { instance_double('Ashikawa::Core::Database') }
|
9
|
+
let(:raw_collection) do
|
10
|
+
{
|
11
|
+
'id' => '60768679',
|
12
|
+
'name' => 'example_1',
|
13
|
+
'status' => 3,
|
14
|
+
'type' => 2,
|
15
|
+
'error' => false,
|
16
|
+
'code' => 200
|
17
|
+
}
|
18
|
+
end
|
19
|
+
let(:graph) { instance_double('Ashikawa::Core::Graph') }
|
20
|
+
|
21
|
+
context 'building a vertex collection' do
|
22
|
+
before do
|
23
|
+
allow(graph).to receive(:has_vertex_collection?).with('example_1').and_return(false)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should raise an exception if the graph does not now about the collection yet' do
|
27
|
+
expect do
|
28
|
+
Ashikawa::Core::VertexCollection.new(database, raw_collection, graph)
|
29
|
+
end.to raise_exception(Ashikawa::Core::CollectionNotInGraphException)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'an initialized vertex collection' do
|
34
|
+
subject { Ashikawa::Core::VertexCollection.new(database, raw_collection, graph) }
|
35
|
+
|
36
|
+
before do
|
37
|
+
allow(graph).to receive(:has_vertex_collection?).with('example_1').and_return(true)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should be a subclass of Collection' do
|
41
|
+
expect(subject).to be_kind_of Ashikawa::Core::Collection
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should have a reference to its graph' do
|
45
|
+
expect(subject.graph).to eq graph
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ashikawa-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- moonglum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -266,19 +266,23 @@ files:
|
|
266
266
|
- lib/ashikawa-core/database.rb
|
267
267
|
- lib/ashikawa-core/document.rb
|
268
268
|
- lib/ashikawa-core/edge.rb
|
269
|
+
- lib/ashikawa-core/edge_collection.rb
|
269
270
|
- lib/ashikawa-core/error_response.rb
|
270
271
|
- lib/ashikawa-core/exceptions/client_error.rb
|
271
272
|
- lib/ashikawa-core/exceptions/client_error/authentication_failed.rb
|
272
273
|
- lib/ashikawa-core/exceptions/client_error/bad_syntax.rb
|
273
274
|
- lib/ashikawa-core/exceptions/client_error/resource_not_found.rb
|
274
275
|
- lib/ashikawa-core/exceptions/client_error/resource_not_found/collection_not_found.rb
|
276
|
+
- lib/ashikawa-core/exceptions/client_error/resource_not_found/collection_not_in_graph.rb
|
275
277
|
- lib/ashikawa-core/exceptions/client_error/resource_not_found/document_not_found.rb
|
278
|
+
- lib/ashikawa-core/exceptions/client_error/resource_not_found/graph_not_found.rb
|
276
279
|
- lib/ashikawa-core/exceptions/client_error/resource_not_found/index_not_found.rb
|
277
280
|
- lib/ashikawa-core/exceptions/no_collection_provided.rb
|
278
281
|
- lib/ashikawa-core/exceptions/server_error.rb
|
279
282
|
- lib/ashikawa-core/exceptions/server_error/json_error.rb
|
280
283
|
- lib/ashikawa-core/faraday_factory.rb
|
281
284
|
- lib/ashikawa-core/figure.rb
|
285
|
+
- lib/ashikawa-core/graph.rb
|
282
286
|
- lib/ashikawa-core/index.rb
|
283
287
|
- lib/ashikawa-core/key_options.rb
|
284
288
|
- lib/ashikawa-core/minimal_logger.rb
|
@@ -286,8 +290,11 @@ files:
|
|
286
290
|
- lib/ashikawa-core/status.rb
|
287
291
|
- lib/ashikawa-core/transaction.rb
|
288
292
|
- lib/ashikawa-core/version.rb
|
293
|
+
- lib/ashikawa-core/vertex_collection.rb
|
294
|
+
- lib/ashikawa-core/x_arango_version.rb
|
289
295
|
- log/.gitkeep
|
290
296
|
- spec/acceptance/basic_spec.rb
|
297
|
+
- spec/acceptance/graph_spec.rb
|
291
298
|
- spec/acceptance/index_spec.rb
|
292
299
|
- spec/acceptance/query_spec.rb
|
293
300
|
- spec/acceptance/spec_helper.rb
|
@@ -323,10 +330,12 @@ files:
|
|
323
330
|
- spec/unit/cursor_spec.rb
|
324
331
|
- spec/unit/database_spec.rb
|
325
332
|
- spec/unit/document_spec.rb
|
333
|
+
- spec/unit/edge_collection_spec.rb
|
326
334
|
- spec/unit/edge_spec.rb
|
327
335
|
- spec/unit/exception_spec.rb
|
328
336
|
- spec/unit/faraday_factory_spec.rb
|
329
337
|
- spec/unit/figure_spec.rb
|
338
|
+
- spec/unit/graph_spec.rb
|
330
339
|
- spec/unit/index_spec.rb
|
331
340
|
- spec/unit/key_options_spec.rb
|
332
341
|
- spec/unit/minimal_logger_spec.rb
|
@@ -334,6 +343,7 @@ files:
|
|
334
343
|
- spec/unit/spec_helper.rb
|
335
344
|
- spec/unit/status_spec.rb
|
336
345
|
- spec/unit/transaction_spec.rb
|
346
|
+
- spec/unit/vertex_collection_spec.rb
|
337
347
|
homepage: http://triagens.github.com/ashikawa-core
|
338
348
|
licenses:
|
339
349
|
- Apache License 2.0
|
@@ -355,12 +365,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
365
|
requirements:
|
356
366
|
- ArangoDB, v2.1
|
357
367
|
rubyforge_project: ashikawa-core
|
358
|
-
rubygems_version: 2.
|
368
|
+
rubygems_version: 2.2.2
|
359
369
|
signing_key:
|
360
370
|
specification_version: 4
|
361
371
|
summary: Ashikawa Core is a wrapper around the ArangoDB REST API
|
362
372
|
test_files:
|
363
373
|
- spec/acceptance/basic_spec.rb
|
374
|
+
- spec/acceptance/graph_spec.rb
|
364
375
|
- spec/acceptance/index_spec.rb
|
365
376
|
- spec/acceptance/query_spec.rb
|
366
377
|
- spec/acceptance/spec_helper.rb
|
@@ -396,10 +407,12 @@ test_files:
|
|
396
407
|
- spec/unit/cursor_spec.rb
|
397
408
|
- spec/unit/database_spec.rb
|
398
409
|
- spec/unit/document_spec.rb
|
410
|
+
- spec/unit/edge_collection_spec.rb
|
399
411
|
- spec/unit/edge_spec.rb
|
400
412
|
- spec/unit/exception_spec.rb
|
401
413
|
- spec/unit/faraday_factory_spec.rb
|
402
414
|
- spec/unit/figure_spec.rb
|
415
|
+
- spec/unit/graph_spec.rb
|
403
416
|
- spec/unit/index_spec.rb
|
404
417
|
- spec/unit/key_options_spec.rb
|
405
418
|
- spec/unit/minimal_logger_spec.rb
|
@@ -407,4 +420,5 @@ test_files:
|
|
407
420
|
- spec/unit/spec_helper.rb
|
408
421
|
- spec/unit/status_spec.rb
|
409
422
|
- spec/unit/transaction_spec.rb
|
423
|
+
- spec/unit/vertex_collection_spec.rb
|
410
424
|
has_rdoc:
|