orientdb_client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +95 -0
- data/Rakefile +30 -0
- data/lib/orientdb_client.rb +378 -0
- data/lib/orientdb_client/class_configurator.rb +10 -0
- data/lib/orientdb_client/errors.rb +35 -0
- data/lib/orientdb_client/http_adapters.rb +25 -0
- data/lib/orientdb_client/http_adapters/curb_adapter.rb +35 -0
- data/lib/orientdb_client/http_adapters/typhoeus_adapter.rb +53 -0
- data/lib/orientdb_client/test.rb +9 -0
- data/lib/orientdb_client/version.rb +3 -0
- data/orientdb_client.gemspec +31 -0
- data/spec/curb_adapter_spec.rb +8 -0
- data/spec/orientdb_client_spec.rb +703 -0
- data/spec/spec_helper.rb +111 -0
- data/spec/support/shared_examples_for_http_adapter.rb +67 -0
- data/spec/typhoeus_adapter_spec.rb +8 -0
- metadata +196 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
|
20
|
+
require 'byebug'
|
21
|
+
require 'orientdb_client'
|
22
|
+
require 'orientdb_client/test'
|
23
|
+
|
24
|
+
require 'webmock/rspec'
|
25
|
+
WebMock.disable_net_connect!(:allow_localhost => true)
|
26
|
+
|
27
|
+
$db = ENV['ORIENTDB_TEST_DATABASENAME'] || OrientdbClient::Test::DatabaseName
|
28
|
+
|
29
|
+
RSpec.configure do |config|
|
30
|
+
# rspec-expectations config goes here. You can use an alternate
|
31
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
32
|
+
# assertions if you prefer.
|
33
|
+
config.expect_with :rspec do |expectations|
|
34
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
35
|
+
# and `failure_message` of custom matchers include text for helper methods
|
36
|
+
# defined using `chain`, e.g.:
|
37
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
38
|
+
# # => "be bigger than 2 and smaller than 4"
|
39
|
+
# ...rather than:
|
40
|
+
# # => "be bigger than 2"
|
41
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
42
|
+
end
|
43
|
+
|
44
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
45
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
46
|
+
config.mock_with :rspec do |mocks|
|
47
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
48
|
+
# a real object. This is generally recommended, and will default to
|
49
|
+
# `true` in RSpec 4.
|
50
|
+
mocks.verify_partial_doubles = true
|
51
|
+
end
|
52
|
+
|
53
|
+
config.disable_monkey_patching!
|
54
|
+
config.profile_examples = 10
|
55
|
+
config.order = :random
|
56
|
+
Kernel.srand config.seed
|
57
|
+
|
58
|
+
# The settings below are suggested to provide a good initial experience
|
59
|
+
# with RSpec, but feel free to customize to your heart's content.
|
60
|
+
=begin
|
61
|
+
# These two settings work together to allow you to limit a spec run
|
62
|
+
# to individual examples or groups you care about by tagging them with
|
63
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
64
|
+
# get run.
|
65
|
+
config.filter_run :focus
|
66
|
+
config.run_all_when_everything_filtered = true
|
67
|
+
|
68
|
+
# Allows RSpec to persist some state between runs in order to support
|
69
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
70
|
+
# you configure your source control system to ignore this file.
|
71
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
72
|
+
|
73
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
74
|
+
# recommended. For more details, see:
|
75
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
76
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
77
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
78
|
+
config.disable_monkey_patching!
|
79
|
+
|
80
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
81
|
+
# be too noisy due to issues in dependencies.
|
82
|
+
config.warnings = true
|
83
|
+
|
84
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
85
|
+
# file, and it's useful to allow more verbose output when running an
|
86
|
+
# individual spec file.
|
87
|
+
if config.files_to_run.one?
|
88
|
+
# Use the documentation formatter for detailed output,
|
89
|
+
# unless a formatter has already been configured
|
90
|
+
# (e.g. via a command-line flag).
|
91
|
+
config.default_formatter = 'doc'
|
92
|
+
end
|
93
|
+
|
94
|
+
# Print the 10 slowest examples and example groups at the
|
95
|
+
# end of the spec run, to help surface which specs are running
|
96
|
+
# particularly slow.
|
97
|
+
config.profile_examples = 10
|
98
|
+
|
99
|
+
# Run specs in random order to surface order dependencies. If you find an
|
100
|
+
# order dependency and want to debug it, you can fix the order by providing
|
101
|
+
# the seed, which is printed after each run.
|
102
|
+
# --seed 1234
|
103
|
+
config.order = :random
|
104
|
+
|
105
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
106
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
107
|
+
# test failures related to randomization by passing the same `--seed` value
|
108
|
+
# as the one that triggered the failure.
|
109
|
+
Kernel.srand config.seed
|
110
|
+
=end
|
111
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
RSpec.shared_examples 'http adapter' do
|
2
|
+
let(:adapter) { adapter_klass.new }
|
3
|
+
|
4
|
+
describe 'username and password' do
|
5
|
+
it 'allows username and password to be set and unset' do
|
6
|
+
adapter.username = 'test'
|
7
|
+
adapter.password = 'pw'
|
8
|
+
expect(adapter.username).to eq('test')
|
9
|
+
expect(adapter.password).to eq('pw')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#reset_credentials' do
|
14
|
+
it 'resets usernamd and password' do
|
15
|
+
adapter.username = 'test'
|
16
|
+
adapter.password = 'pw'
|
17
|
+
adapter.reset_credentials
|
18
|
+
expect(adapter.username).to be_nil
|
19
|
+
expect(adapter.password).to be_nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#request' do
|
24
|
+
describe 'GET' do
|
25
|
+
let(:url) { 'http://localhost:2480/listDatabases' }
|
26
|
+
|
27
|
+
it 'makes GET request' do
|
28
|
+
stub_request(:get, url).
|
29
|
+
to_return(:status => 200, :body => "", :headers => {})
|
30
|
+
adapter.request(:get, url)
|
31
|
+
expect(WebMock).to have_requested(:get, url)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'returns a response that responds to `response_code`' do
|
35
|
+
stub_request(:get, url).
|
36
|
+
to_return(:status => 200, :body => {a: 1}.to_json, :headers => {})
|
37
|
+
r = adapter.request(:get, url)
|
38
|
+
expect(r.response_code).to eq(200)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'returns a response that responds to `body`' do
|
42
|
+
stub_request(:get, url).
|
43
|
+
to_return(:status => 200, :body => {a: 1}.to_json, :headers => {})
|
44
|
+
r = adapter.request(:get, url)
|
45
|
+
expect(r.body).to eq({a: 1}.to_json)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'returns a response that responds to `content_type`' do
|
49
|
+
stub_request(:get, url).
|
50
|
+
to_return(:status => 200, :body => {a: 1}.to_json, :headers => {'Content-Type' => 'application/json; charset=utf8'})
|
51
|
+
r = adapter.request(:get, url)
|
52
|
+
expect(r.content_type).to eq('application/json; charset=utf8')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'POST' do
|
57
|
+
let(:url) { 'http://localhost:2480/database/test/plocal/graph' }
|
58
|
+
|
59
|
+
it 'makes POST request' do
|
60
|
+
stub_request(:post, "http://localhost:2480/database/test/plocal/graph").
|
61
|
+
to_return(:status => 200, :body => "", :headers => {})
|
62
|
+
adapter.request(:post, url)
|
63
|
+
expect(WebMock).to have_requested(:post, url)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: orientdb_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Luke Rodgers
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: typhoeus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: oj
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rainbow
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.99'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.99'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-mocks
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.22'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.22'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: byebug
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Orientdb ruby client aiming to be simple, fast, and provide good integration
|
140
|
+
with Orientdb error messages.
|
141
|
+
email:
|
142
|
+
- lukeasrodgers@gmail.com
|
143
|
+
executables: []
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".rspec"
|
149
|
+
- Gemfile
|
150
|
+
- LICENSE.txt
|
151
|
+
- README.md
|
152
|
+
- Rakefile
|
153
|
+
- lib/orientdb_client.rb
|
154
|
+
- lib/orientdb_client/class_configurator.rb
|
155
|
+
- lib/orientdb_client/errors.rb
|
156
|
+
- lib/orientdb_client/http_adapters.rb
|
157
|
+
- lib/orientdb_client/http_adapters/curb_adapter.rb
|
158
|
+
- lib/orientdb_client/http_adapters/typhoeus_adapter.rb
|
159
|
+
- lib/orientdb_client/test.rb
|
160
|
+
- lib/orientdb_client/version.rb
|
161
|
+
- orientdb_client.gemspec
|
162
|
+
- spec/curb_adapter_spec.rb
|
163
|
+
- spec/orientdb_client_spec.rb
|
164
|
+
- spec/spec_helper.rb
|
165
|
+
- spec/support/shared_examples_for_http_adapter.rb
|
166
|
+
- spec/typhoeus_adapter_spec.rb
|
167
|
+
homepage: ''
|
168
|
+
licenses:
|
169
|
+
- MIT
|
170
|
+
metadata: {}
|
171
|
+
post_install_message:
|
172
|
+
rdoc_options: []
|
173
|
+
require_paths:
|
174
|
+
- lib
|
175
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
requirements: []
|
186
|
+
rubyforge_project:
|
187
|
+
rubygems_version: 2.2.2
|
188
|
+
signing_key:
|
189
|
+
specification_version: 4
|
190
|
+
summary: Orientdb ruby client
|
191
|
+
test_files:
|
192
|
+
- spec/curb_adapter_spec.rb
|
193
|
+
- spec/orientdb_client_spec.rb
|
194
|
+
- spec/spec_helper.rb
|
195
|
+
- spec/support/shared_examples_for_http_adapter.rb
|
196
|
+
- spec/typhoeus_adapter_spec.rb
|