grpc 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +1 -0
- data/.rubocop.yml +10 -0
- data/.rubocop_todo.yml +52 -0
- data/Gemfile +4 -0
- data/README.md +82 -0
- data/Rakefile +54 -0
- data/bin/apis/google/protobuf/empty.rb +44 -0
- data/bin/apis/pubsub_demo.rb +267 -0
- data/bin/apis/tech/pubsub/proto/pubsub.rb +174 -0
- data/bin/apis/tech/pubsub/proto/pubsub_services.rb +103 -0
- data/bin/interop/README.md +8 -0
- data/bin/interop/interop_client.rb +334 -0
- data/bin/interop/interop_server.rb +192 -0
- data/bin/interop/test/cpp/interop/empty.rb +44 -0
- data/bin/interop/test/cpp/interop/messages.rb +89 -0
- data/bin/interop/test/cpp/interop/test.rb +43 -0
- data/bin/interop/test/cpp/interop/test_services.rb +60 -0
- data/bin/math.proto +80 -0
- data/bin/math.rb +61 -0
- data/bin/math_client.rb +147 -0
- data/bin/math_server.rb +190 -0
- data/bin/math_services.rb +56 -0
- data/bin/noproto_client.rb +108 -0
- data/bin/noproto_server.rb +112 -0
- data/ext/grpc/extconf.rb +76 -0
- data/ext/grpc/rb_byte_buffer.c +241 -0
- data/ext/grpc/rb_byte_buffer.h +54 -0
- data/ext/grpc/rb_call.c +569 -0
- data/ext/grpc/rb_call.h +59 -0
- data/ext/grpc/rb_channel.c +264 -0
- data/ext/grpc/rb_channel.h +49 -0
- data/ext/grpc/rb_channel_args.c +154 -0
- data/ext/grpc/rb_channel_args.h +52 -0
- data/ext/grpc/rb_completion_queue.c +185 -0
- data/ext/grpc/rb_completion_queue.h +50 -0
- data/ext/grpc/rb_credentials.c +281 -0
- data/ext/grpc/rb_credentials.h +50 -0
- data/ext/grpc/rb_event.c +361 -0
- data/ext/grpc/rb_event.h +53 -0
- data/ext/grpc/rb_grpc.c +274 -0
- data/ext/grpc/rb_grpc.h +74 -0
- data/ext/grpc/rb_metadata.c +215 -0
- data/ext/grpc/rb_metadata.h +53 -0
- data/ext/grpc/rb_server.c +278 -0
- data/ext/grpc/rb_server.h +50 -0
- data/ext/grpc/rb_server_credentials.c +210 -0
- data/ext/grpc/rb_server_credentials.h +50 -0
- data/grpc.gemspec +41 -0
- data/lib/grpc.rb +39 -0
- data/lib/grpc/core/event.rb +44 -0
- data/lib/grpc/core/time_consts.rb +71 -0
- data/lib/grpc/errors.rb +61 -0
- data/lib/grpc/generic/active_call.rb +536 -0
- data/lib/grpc/generic/bidi_call.rb +221 -0
- data/lib/grpc/generic/client_stub.rb +413 -0
- data/lib/grpc/generic/rpc_desc.rb +150 -0
- data/lib/grpc/generic/rpc_server.rb +404 -0
- data/lib/grpc/generic/service.rb +235 -0
- data/lib/grpc/logconfig.rb +40 -0
- data/lib/grpc/version.rb +33 -0
- data/spec/alloc_spec.rb +44 -0
- data/spec/byte_buffer_spec.rb +67 -0
- data/spec/call_spec.rb +163 -0
- data/spec/channel_spec.rb +181 -0
- data/spec/client_server_spec.rb +372 -0
- data/spec/completion_queue_spec.rb +74 -0
- data/spec/credentials_spec.rb +71 -0
- data/spec/event_spec.rb +53 -0
- data/spec/generic/active_call_spec.rb +373 -0
- data/spec/generic/client_stub_spec.rb +519 -0
- data/spec/generic/rpc_desc_spec.rb +357 -0
- data/spec/generic/rpc_server_pool_spec.rb +139 -0
- data/spec/generic/rpc_server_spec.rb +404 -0
- data/spec/generic/service_spec.rb +342 -0
- data/spec/metadata_spec.rb +64 -0
- data/spec/server_credentials_spec.rb +69 -0
- data/spec/server_spec.rb +212 -0
- data/spec/spec_helper.rb +51 -0
- data/spec/testdata/README +1 -0
- data/spec/testdata/ca.pem +15 -0
- data/spec/testdata/server1.key +16 -0
- data/spec/testdata/server1.pem +16 -0
- data/spec/time_consts_spec.rb +89 -0
- metadata +353 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
# Copyright 2015, Google Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are
|
6
|
+
# met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above
|
11
|
+
# copyright notice, this list of conditions and the following disclaimer
|
12
|
+
# in the documentation and/or other materials provided with the
|
13
|
+
# distribution.
|
14
|
+
# * Neither the name of Google Inc. nor the names of its
|
15
|
+
# contributors may be used to endorse or promote products derived from
|
16
|
+
# this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
require 'grpc'
|
31
|
+
|
32
|
+
describe GRPC::Core::Metadata do
|
33
|
+
describe '#new' do
|
34
|
+
it 'should create instances' do
|
35
|
+
expect { GRPC::Core::Metadata.new('a key', 'a value') }.to_not raise_error
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#key' do
|
40
|
+
md = GRPC::Core::Metadata.new('a key', 'a value')
|
41
|
+
it 'should be the constructor value' do
|
42
|
+
expect(md.key).to eq('a key')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#value' do
|
47
|
+
md = GRPC::Core::Metadata.new('a key', 'a value')
|
48
|
+
it 'should be the constuctor value' do
|
49
|
+
expect(md.value).to eq('a value')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#dup' do
|
54
|
+
it 'should create a copy that returns the correct key' do
|
55
|
+
md = GRPC::Core::Metadata.new('a key', 'a value')
|
56
|
+
expect(md.dup.key).to eq('a key')
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should create a copy that returns the correct value' do
|
60
|
+
md = GRPC::Core::Metadata.new('a key', 'a value')
|
61
|
+
expect(md.dup.value).to eq('a value')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Copyright 2015, Google Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are
|
6
|
+
# met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above
|
11
|
+
# copyright notice, this list of conditions and the following disclaimer
|
12
|
+
# in the documentation and/or other materials provided with the
|
13
|
+
# distribution.
|
14
|
+
# * Neither the name of Google Inc. nor the names of its
|
15
|
+
# contributors may be used to endorse or promote products derived from
|
16
|
+
# this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
require 'grpc'
|
31
|
+
|
32
|
+
def load_test_certs
|
33
|
+
test_root = File.join(File.dirname(__FILE__), 'testdata')
|
34
|
+
files = ['ca.pem', 'server1.pem', 'server1.key']
|
35
|
+
files.map { |f| File.open(File.join(test_root, f)).read }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe GRPC::Core::ServerCredentials do
|
39
|
+
Creds = GRPC::Core::ServerCredentials
|
40
|
+
|
41
|
+
describe '#new' do
|
42
|
+
it 'can be constructed from a fake CA PEM, server PEM and a server key' do
|
43
|
+
expect { Creds.new('a', 'b', 'c') }.not_to raise_error
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'can be constructed using the test certificates' do
|
47
|
+
certs = load_test_certs
|
48
|
+
expect { Creds.new(*certs) }.not_to raise_error
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'cannot be constructed without a server cert chain' do
|
52
|
+
root_cert, server_key, _ = load_test_certs
|
53
|
+
blk = proc { Creds.new(root_cert, server_key, nil) }
|
54
|
+
expect(&blk).to raise_error
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'cannot be constructed without a server key' do
|
58
|
+
root_cert, _, _ = load_test_certs
|
59
|
+
blk = proc { Creds.new(root_cert, nil, cert_chain) }
|
60
|
+
expect(&blk).to raise_error
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'can be constructed without a root_cret' do
|
64
|
+
_, server_key, cert_chain = load_test_certs
|
65
|
+
blk = proc { Creds.new(nil, server_key, cert_chain) }
|
66
|
+
expect(&blk).to_not raise_error
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/spec/server_spec.rb
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
# Copyright 2015, Google Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are
|
6
|
+
# met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above
|
11
|
+
# copyright notice, this list of conditions and the following disclaimer
|
12
|
+
# in the documentation and/or other materials provided with the
|
13
|
+
# distribution.
|
14
|
+
# * Neither the name of Google Inc. nor the names of its
|
15
|
+
# contributors may be used to endorse or promote products derived from
|
16
|
+
# this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
require 'grpc'
|
31
|
+
|
32
|
+
def load_test_certs
|
33
|
+
test_root = File.join(File.dirname(__FILE__), 'testdata')
|
34
|
+
files = ['ca.pem', 'server1.key', 'server1.pem']
|
35
|
+
files.map { |f| File.open(File.join(test_root, f)).read }
|
36
|
+
end
|
37
|
+
|
38
|
+
Server = GRPC::Core::Server
|
39
|
+
|
40
|
+
describe Server do
|
41
|
+
def create_test_cert
|
42
|
+
GRPC::Core::ServerCredentials.new(*load_test_certs)
|
43
|
+
end
|
44
|
+
|
45
|
+
before(:each) do
|
46
|
+
@cq = GRPC::Core::CompletionQueue.new
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#start' do
|
50
|
+
it 'runs without failing' do
|
51
|
+
blk = proc { Server.new(@cq, nil).start }
|
52
|
+
expect(&blk).to_not raise_error
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'fails if the server is closed' do
|
56
|
+
s = Server.new(@cq, nil)
|
57
|
+
s.close
|
58
|
+
expect { s.start }.to raise_error(RuntimeError)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#destroy' do
|
63
|
+
it 'destroys a server ok' do
|
64
|
+
s = start_a_server
|
65
|
+
blk = proc { s.destroy }
|
66
|
+
expect(&blk).to_not raise_error
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'can be called more than once without error' do
|
70
|
+
s = start_a_server
|
71
|
+
begin
|
72
|
+
blk = proc { s.destroy }
|
73
|
+
expect(&blk).to_not raise_error
|
74
|
+
blk.call
|
75
|
+
expect(&blk).to_not raise_error
|
76
|
+
ensure
|
77
|
+
s.close
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe '#close' do
|
83
|
+
it 'closes a server ok' do
|
84
|
+
s = start_a_server
|
85
|
+
begin
|
86
|
+
blk = proc { s.close }
|
87
|
+
expect(&blk).to_not raise_error
|
88
|
+
ensure
|
89
|
+
s.close
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'can be called more than once without error' do
|
94
|
+
s = start_a_server
|
95
|
+
blk = proc { s.close }
|
96
|
+
expect(&blk).to_not raise_error
|
97
|
+
blk.call
|
98
|
+
expect(&blk).to_not raise_error
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe '#add_http_port' do
|
103
|
+
describe 'for insecure servers' do
|
104
|
+
it 'runs without failing' do
|
105
|
+
blk = proc do
|
106
|
+
s = Server.new(@cq, nil)
|
107
|
+
s.add_http2_port('localhost:0')
|
108
|
+
s.close
|
109
|
+
end
|
110
|
+
expect(&blk).to_not raise_error
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'fails if the server is closed' do
|
114
|
+
s = Server.new(@cq, nil)
|
115
|
+
s.close
|
116
|
+
expect { s.add_http2_port('localhost:0') }.to raise_error(RuntimeError)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe 'for secure servers' do
|
121
|
+
it 'runs without failing' do
|
122
|
+
blk = proc do
|
123
|
+
s = Server.new(@cq, nil)
|
124
|
+
s.add_http2_port('localhost:0', true)
|
125
|
+
s.close
|
126
|
+
end
|
127
|
+
expect(&blk).to_not raise_error
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'fails if the server is closed' do
|
131
|
+
s = Server.new(@cq, nil)
|
132
|
+
s.close
|
133
|
+
blk = proc { s.add_http2_port('localhost:0', true) }
|
134
|
+
expect(&blk).to raise_error(RuntimeError)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
shared_examples '#new' do
|
140
|
+
it 'takes a completion queue with nil channel args' do
|
141
|
+
expect { Server.new(@cq, nil, create_test_cert) }.to_not raise_error
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'does not take a hash with bad keys as channel args' do
|
145
|
+
blk = construct_with_args(Object.new => 1)
|
146
|
+
expect(&blk).to raise_error TypeError
|
147
|
+
blk = construct_with_args(1 => 1)
|
148
|
+
expect(&blk).to raise_error TypeError
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'does not take a hash with bad values as channel args' do
|
152
|
+
blk = construct_with_args(symbol: Object.new)
|
153
|
+
expect(&blk).to raise_error TypeError
|
154
|
+
blk = construct_with_args('1' => Hash.new)
|
155
|
+
expect(&blk).to raise_error TypeError
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'can take a hash with a symbol key as channel args' do
|
159
|
+
blk = construct_with_args(a_symbol: 1)
|
160
|
+
expect(&blk).to_not raise_error
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'can take a hash with a string key as channel args' do
|
164
|
+
blk = construct_with_args('a_symbol' => 1)
|
165
|
+
expect(&blk).to_not raise_error
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'can take a hash with a string value as channel args' do
|
169
|
+
blk = construct_with_args(a_symbol: '1')
|
170
|
+
expect(&blk).to_not raise_error
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'can take a hash with a symbol value as channel args' do
|
174
|
+
blk = construct_with_args(a_symbol: :another_symbol)
|
175
|
+
expect(&blk).to_not raise_error
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'can take a hash with a numeric value as channel args' do
|
179
|
+
blk = construct_with_args(a_symbol: 1)
|
180
|
+
expect(&blk).to_not raise_error
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'can take a hash with many args as channel args' do
|
184
|
+
args = Hash[127.times.collect { |x| [x.to_s, x] }]
|
185
|
+
blk = construct_with_args(args)
|
186
|
+
expect(&blk).to_not raise_error
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
describe '#new with an insecure channel' do
|
191
|
+
def construct_with_args(a)
|
192
|
+
proc { Server.new(@cq, a) }
|
193
|
+
end
|
194
|
+
|
195
|
+
it_behaves_like '#new'
|
196
|
+
end
|
197
|
+
|
198
|
+
describe '#new with a secure channel' do
|
199
|
+
def construct_with_args(a)
|
200
|
+
proc { Server.new(@cq, a, create_test_cert) }
|
201
|
+
end
|
202
|
+
|
203
|
+
it_behaves_like '#new'
|
204
|
+
end
|
205
|
+
|
206
|
+
def start_a_server
|
207
|
+
s = Server.new(@cq, nil)
|
208
|
+
s.add_http2_port('0.0.0.0:0')
|
209
|
+
s.start
|
210
|
+
s
|
211
|
+
end
|
212
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Copyright 2015, Google Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are
|
6
|
+
# met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above
|
11
|
+
# copyright notice, this list of conditions and the following disclaimer
|
12
|
+
# in the documentation and/or other materials provided with the
|
13
|
+
# distribution.
|
14
|
+
# * Neither the name of Google Inc. nor the names of its
|
15
|
+
# contributors may be used to endorse or promote products derived from
|
16
|
+
# this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
spec_dir = File.expand_path(File.dirname(__FILE__))
|
31
|
+
root_dir = File.expand_path(File.join(spec_dir, '..'))
|
32
|
+
lib_dir = File.expand_path(File.join(root_dir, 'lib'))
|
33
|
+
|
34
|
+
$LOAD_PATH.unshift(spec_dir)
|
35
|
+
$LOAD_PATH.unshift(lib_dir)
|
36
|
+
$LOAD_PATH.uniq!
|
37
|
+
|
38
|
+
require 'faraday'
|
39
|
+
require 'rspec'
|
40
|
+
require 'logging'
|
41
|
+
require 'rspec/logging_helper'
|
42
|
+
|
43
|
+
# Allow Faraday to support test stubs
|
44
|
+
Faraday::Adapter.load_middleware(:test)
|
45
|
+
|
46
|
+
# Configure RSpec to capture log messages for each test. The output from the
|
47
|
+
# logs will be stored in the @log_output variable. It is a StringIO instance.
|
48
|
+
RSpec.configure do |config|
|
49
|
+
include RSpec::LoggingHelper
|
50
|
+
config.capture_log_messages
|
51
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
These are test keys *NOT* to be used in production.
|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