ashikawa-core 0.8.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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +3 -3
  4. data/CHANGELOG.md +49 -0
  5. data/Gemfile +3 -2
  6. data/Gemfile.devtools +14 -22
  7. data/Guardfile +3 -2
  8. data/README.md +37 -6
  9. data/Rakefile +2 -1
  10. data/ashikawa-core.gemspec +2 -2
  11. data/cache/Mac_applications +1 -0
  12. data/config/devtools.yml +5 -0
  13. data/config/flay.yml +1 -1
  14. data/config/flog.yml +1 -2
  15. data/config/reek.yml +1 -1
  16. data/config/rubocop.yml +23 -25
  17. data/lib/ashikawa-core.rb +6 -5
  18. data/lib/ashikawa-core/collection.rb +142 -165
  19. data/lib/ashikawa-core/configuration.rb +41 -2
  20. data/lib/ashikawa-core/connection.rb +17 -16
  21. data/lib/ashikawa-core/cursor.rb +18 -12
  22. data/lib/ashikawa-core/database.rb +69 -59
  23. data/lib/ashikawa-core/document.rb +22 -20
  24. data/lib/ashikawa-core/edge.rb +8 -6
  25. data/lib/ashikawa-core/exceptions/client_error.rb +1 -0
  26. data/lib/ashikawa-core/exceptions/client_error/authentication_failed.rb +25 -0
  27. data/lib/ashikawa-core/exceptions/client_error/bad_syntax.rb +3 -2
  28. data/lib/ashikawa-core/exceptions/client_error/resource_not_found.rb +3 -2
  29. data/lib/ashikawa-core/exceptions/client_error/resource_not_found/collection_not_found.rb +3 -2
  30. data/lib/ashikawa-core/exceptions/client_error/resource_not_found/document_not_found.rb +3 -2
  31. data/lib/ashikawa-core/exceptions/client_error/resource_not_found/index_not_found.rb +3 -2
  32. data/lib/ashikawa-core/exceptions/no_collection_provided.rb +1 -0
  33. data/lib/ashikawa-core/exceptions/server_error.rb +1 -0
  34. data/lib/ashikawa-core/exceptions/server_error/json_error.rb +3 -2
  35. data/lib/ashikawa-core/figure.rb +18 -17
  36. data/lib/ashikawa-core/index.rb +15 -5
  37. data/lib/ashikawa-core/key_options.rb +5 -4
  38. data/lib/ashikawa-core/query.rb +38 -27
  39. data/lib/ashikawa-core/request_preprocessor.rb +4 -3
  40. data/lib/ashikawa-core/response_preprocessor.rb +64 -24
  41. data/lib/ashikawa-core/status.rb +1 -0
  42. data/lib/ashikawa-core/transaction.rb +12 -11
  43. data/lib/ashikawa-core/version.rb +2 -1
  44. data/spec/acceptance/basic_spec.rb +117 -116
  45. data/spec/acceptance/index_spec.rb +18 -15
  46. data/spec/acceptance/query_spec.rb +61 -64
  47. data/spec/acceptance/spec_helper.rb +26 -3
  48. data/spec/acceptance/transactions_spec.rb +12 -16
  49. data/spec/setup/arangodb.sh +2 -2
  50. data/spec/unit/collection_spec.rb +224 -242
  51. data/spec/unit/configuration_spec.rb +64 -0
  52. data/spec/unit/connection_spec.rb +121 -111
  53. data/spec/unit/cursor_spec.rb +78 -65
  54. data/spec/unit/database_spec.rb +112 -163
  55. data/spec/unit/document_spec.rb +74 -70
  56. data/spec/unit/edge_spec.rb +45 -33
  57. data/spec/unit/exception_spec.rb +28 -38
  58. data/spec/unit/figure_spec.rb +44 -47
  59. data/spec/unit/index_spec.rb +27 -24
  60. data/spec/unit/key_options_spec.rb +19 -17
  61. data/spec/unit/query_spec.rb +186 -135
  62. data/spec/unit/spec_helper.rb +14 -3
  63. data/spec/unit/status_spec.rb +37 -37
  64. data/spec/unit/transaction_spec.rb +71 -74
  65. data/tasks/adjustments.rake +10 -34
  66. metadata +11 -13
  67. data/spec/acceptance/arango_helper.rb +0 -27
  68. data/spec/acceptance_auth/arango_helper.rb +0 -30
  69. data/spec/acceptance_auth/auth_spec.rb +0 -40
  70. 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
@@ -1,6 +0,0 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
-
4
- require "ashikawa-core"
5
-
6
- ARANGO_HOST = "http://localhost:8529"