ashikawa-core 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -3
- data/CHANGELOG.md +49 -0
- data/Gemfile +3 -2
- data/Gemfile.devtools +14 -22
- data/Guardfile +3 -2
- data/README.md +37 -6
- data/Rakefile +2 -1
- data/ashikawa-core.gemspec +2 -2
- data/cache/Mac_applications +1 -0
- data/config/devtools.yml +5 -0
- data/config/flay.yml +1 -1
- data/config/flog.yml +1 -2
- data/config/reek.yml +1 -1
- data/config/rubocop.yml +23 -25
- data/lib/ashikawa-core.rb +6 -5
- data/lib/ashikawa-core/collection.rb +142 -165
- data/lib/ashikawa-core/configuration.rb +41 -2
- data/lib/ashikawa-core/connection.rb +17 -16
- data/lib/ashikawa-core/cursor.rb +18 -12
- data/lib/ashikawa-core/database.rb +69 -59
- data/lib/ashikawa-core/document.rb +22 -20
- data/lib/ashikawa-core/edge.rb +8 -6
- data/lib/ashikawa-core/exceptions/client_error.rb +1 -0
- data/lib/ashikawa-core/exceptions/client_error/authentication_failed.rb +25 -0
- data/lib/ashikawa-core/exceptions/client_error/bad_syntax.rb +3 -2
- data/lib/ashikawa-core/exceptions/client_error/resource_not_found.rb +3 -2
- data/lib/ashikawa-core/exceptions/client_error/resource_not_found/collection_not_found.rb +3 -2
- data/lib/ashikawa-core/exceptions/client_error/resource_not_found/document_not_found.rb +3 -2
- data/lib/ashikawa-core/exceptions/client_error/resource_not_found/index_not_found.rb +3 -2
- data/lib/ashikawa-core/exceptions/no_collection_provided.rb +1 -0
- data/lib/ashikawa-core/exceptions/server_error.rb +1 -0
- data/lib/ashikawa-core/exceptions/server_error/json_error.rb +3 -2
- data/lib/ashikawa-core/figure.rb +18 -17
- data/lib/ashikawa-core/index.rb +15 -5
- data/lib/ashikawa-core/key_options.rb +5 -4
- data/lib/ashikawa-core/query.rb +38 -27
- data/lib/ashikawa-core/request_preprocessor.rb +4 -3
- data/lib/ashikawa-core/response_preprocessor.rb +64 -24
- data/lib/ashikawa-core/status.rb +1 -0
- data/lib/ashikawa-core/transaction.rb +12 -11
- data/lib/ashikawa-core/version.rb +2 -1
- data/spec/acceptance/basic_spec.rb +117 -116
- data/spec/acceptance/index_spec.rb +18 -15
- data/spec/acceptance/query_spec.rb +61 -64
- data/spec/acceptance/spec_helper.rb +26 -3
- data/spec/acceptance/transactions_spec.rb +12 -16
- data/spec/setup/arangodb.sh +2 -2
- data/spec/unit/collection_spec.rb +224 -242
- data/spec/unit/configuration_spec.rb +64 -0
- data/spec/unit/connection_spec.rb +121 -111
- data/spec/unit/cursor_spec.rb +78 -65
- data/spec/unit/database_spec.rb +112 -163
- data/spec/unit/document_spec.rb +74 -70
- data/spec/unit/edge_spec.rb +45 -33
- data/spec/unit/exception_spec.rb +28 -38
- data/spec/unit/figure_spec.rb +44 -47
- data/spec/unit/index_spec.rb +27 -24
- data/spec/unit/key_options_spec.rb +19 -17
- data/spec/unit/query_spec.rb +186 -135
- data/spec/unit/spec_helper.rb +14 -3
- data/spec/unit/status_spec.rb +37 -37
- data/spec/unit/transaction_spec.rb +71 -74
- data/tasks/adjustments.rake +10 -34
- metadata +11 -13
- data/spec/acceptance/arango_helper.rb +0 -27
- data/spec/acceptance_auth/arango_helper.rb +0 -30
- data/spec/acceptance_auth/auth_spec.rb +0 -40
- data/spec/acceptance_auth/spec_helper.rb +0 -6
@@ -1,27 +0,0 @@
|
|
1
|
-
RSpec.configure do |config|
|
2
|
-
raise "Could not find arangod. Please install it or check if it is in your path." if `which arangod` == ""
|
3
|
-
|
4
|
-
database_directory = "/tmp/ashikawa-acceptance"
|
5
|
-
arango_process = false
|
6
|
-
|
7
|
-
config.before(:suite) do
|
8
|
-
puts "Starting ArangoDB"
|
9
|
-
process_id = $$
|
10
|
-
|
11
|
-
Dir.mkdir database_directory unless Dir.exists? database_directory
|
12
|
-
arango_process = IO.popen("arangod #{database_directory} --watch-process #{process_id}")
|
13
|
-
|
14
|
-
sleep 2 # Wait for Arango to start up
|
15
|
-
end
|
16
|
-
|
17
|
-
config.after(:suite) do
|
18
|
-
puts
|
19
|
-
puts "Shutting down ArangoDB"
|
20
|
-
|
21
|
-
Process.kill "INT", arango_process.pid
|
22
|
-
sleep 2 # Wait for Arango to shut down
|
23
|
-
arango_process.close
|
24
|
-
|
25
|
-
`rm -r #{database_directory}/*`
|
26
|
-
end
|
27
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
RSpec.configure do |config|
|
2
|
-
raise "Could not find arangod. Please install it or check if it is in your path." if `which arangod` == ""
|
3
|
-
|
4
|
-
database_directory = "/tmp/ashikawa-acceptance-auth"
|
5
|
-
arango_process = false
|
6
|
-
|
7
|
-
config.before(:suite) do
|
8
|
-
puts "Generating user with password"
|
9
|
-
`arango-password --database #{database_directory} testuser testpassword`
|
10
|
-
|
11
|
-
puts "Starting ArangoDB with authentication enabled"
|
12
|
-
process_id = $$
|
13
|
-
|
14
|
-
Dir.mkdir database_directory unless Dir.exists? database_directory
|
15
|
-
arango_process = IO.popen("arangod #{database_directory} --server.http-auth yes --watch-process #{process_id}")
|
16
|
-
|
17
|
-
sleep 2 # Wait for Arango to start up
|
18
|
-
end
|
19
|
-
|
20
|
-
config.after(:suite) do
|
21
|
-
puts
|
22
|
-
puts "Shutting down ArangoDB"
|
23
|
-
|
24
|
-
Process.kill "INT", arango_process.pid
|
25
|
-
sleep 2 # Wait for Arango to shut down
|
26
|
-
arango_process.close
|
27
|
-
|
28
|
-
`rm -r #{database_directory}/*`
|
29
|
-
end
|
30
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'acceptance_auth/spec_helper'
|
2
|
-
|
3
|
-
describe "authenticated database" do
|
4
|
-
subject { ARANGO_HOST }
|
5
|
-
|
6
|
-
it "should have booted up an ArangoDB instance" do
|
7
|
-
expect { RestClient.get(subject) }.to raise_error RestClient::Unauthorized
|
8
|
-
end
|
9
|
-
|
10
|
-
context "authentication" do
|
11
|
-
subject { Ashikawa::Core::Database.new ARANGO_HOST }
|
12
|
-
|
13
|
-
context "without user and password" do
|
14
|
-
it "should not allow access to DB" do
|
15
|
-
expect do
|
16
|
-
subject["new_collection"]
|
17
|
-
end.to raise_error RestClient::Unauthorized
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context "with user and password" do
|
22
|
-
it "should allow acces to DB" do
|
23
|
-
subject.authenticate_with :username => 'testuser', :password => 'testpassword'
|
24
|
-
|
25
|
-
expect do
|
26
|
-
subject["new_collection"]
|
27
|
-
subject["new_collection"].delete
|
28
|
-
end.to_not raise_error
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should deny acces if username and password are wrong" do
|
32
|
-
subject.authenticate_with :username => 'ruffy', :password => 'three_headed_monkey'
|
33
|
-
|
34
|
-
expect do
|
35
|
-
subject["denied"]
|
36
|
-
end.to raise_error RestClient::Unauthorized
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|