grpc_mock 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grpc_mock/errors.rb +7 -0
- data/lib/grpc_mock/grpc_stub_adapter.rb +10 -1
- data/lib/grpc_mock/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd11a8a9fe51756f230dd787fe6996643c68a7d4
|
4
|
+
data.tar.gz: 2f3567d682c7d6e934ba7a8ca4c1f64cc98f6fc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88dd0416c9169efe35bcb329eb6bb238458081adc70924f93e8d420b612f5aad88cc1aabd799ad010a672a990d03c584ba2aed3726c725963f0d3129ebf2e8ff
|
7
|
+
data.tar.gz: a1660786ac25573a5fb282b29fd31966cc9eedf0ee73a242f3df224a5109ff9088b49e723869ac4b3cab1bf1f954d7a9df8a1b3d398c2e002f80012dad44f75e
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'grpc'
|
2
|
+
require 'grpc_mock/errors'
|
2
3
|
|
3
4
|
module GrpcMock
|
4
5
|
class GrpcStubAdapter
|
@@ -17,29 +18,37 @@ module GrpcMock
|
|
17
18
|
def request_response(method, req, marshal, unmarshal, **opt)
|
18
19
|
if GrpcMock.config.allow_net_connect
|
19
20
|
original_request_response(method, req, marshal, unmarshal, **opt)
|
21
|
+
else
|
22
|
+
raise NetConnectNotAllowedError, method
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
23
26
|
def client_streamer(method, requests, marshal, unmarshal, **opt)
|
24
27
|
if GrpcMock.config.allow_net_connect
|
25
28
|
original_client_streamer(method, requests, marshal, unmarshal, **opt)
|
29
|
+
else
|
30
|
+
raise NetConnectNotAllowedError, method
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
29
34
|
def server_streamer(method, req, marshal, unmarshal, **opt)
|
30
35
|
if GrpcMock.config.allow_net_connect
|
31
36
|
original_server_streamer(method, req, marshal, unmarshal, **opt)
|
37
|
+
else
|
38
|
+
raise NetConnectNotAllowedError, method
|
32
39
|
end
|
33
40
|
end
|
34
41
|
|
35
42
|
def bidi_streamer(method, requests, marshal, unmarshal, **opt)
|
36
43
|
if GrpcMock.config.allow_net_connect
|
37
44
|
original_bidi_streamer(method, requests, marshal, unmarshal, **opt)
|
45
|
+
else
|
46
|
+
raise NetConnectNotAllowedError, method
|
38
47
|
end
|
39
48
|
end
|
40
49
|
end
|
41
50
|
|
42
|
-
# This class is only
|
51
|
+
# This class is only used for disabling grpc_stub_adapter hook
|
43
52
|
THROUGHT_CLASS = Module.new do
|
44
53
|
def request_response(method, req, marshal, unmarshal, **opt)
|
45
54
|
original_request_response(method, req, marshal, unmarshal, **opt)
|
data/lib/grpc_mock/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grpc_mock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ganmacs
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/grpc_mock.rb
|
131
131
|
- lib/grpc_mock/adapter.rb
|
132
132
|
- lib/grpc_mock/configure.rb
|
133
|
+
- lib/grpc_mock/errors.rb
|
133
134
|
- lib/grpc_mock/grpc_stub_adapter.rb
|
134
135
|
- lib/grpc_mock/rspec.rb
|
135
136
|
- lib/grpc_mock/version.rb
|