protobuf 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a25179bb7b98c63e8ef320ebbed6b649244897af
4
- data.tar.gz: 3df0b7a26092c7e5ac79c75893ec965f4fefd150
3
+ metadata.gz: dd448f24362b0e9378d3281d77291538d862d4d1
4
+ data.tar.gz: 592b16f0af1c48b7c8336ea32f35a646f3947a9c
5
5
  SHA512:
6
- metadata.gz: 876507d1ac360749d4cb83c029ecf14632c0a452ce8005e8503f33a1f44d65bf1f6a690566e5d3eb4a2411b1450141200c61109e94dee9a56c18f87b83a1d583
7
- data.tar.gz: 0b83772263222d04aadaf02f1ef82d3cfaf5363fb45e30615b791cce632beb43ab1c6be5124c3d78ff18083a29032965a96b1b3af31278b3da2830f7a66464d8
6
+ metadata.gz: a73428f4308d156ea94d9737e792b16db2455013a976ef6c5e22f2ca7f59ab156e43323816d1c30099934131fdde704d3741becf909decf76cf590b36d0fd75c
7
+ data.tar.gz: 9e66f6d8762f9c62c2d1ce01c34fc1ef841ebd32c05bc8630d0008f05572e7c9644e197e9e66d74bee08cc77b81a20c3f8c4300c64524ef8839dc8bea44ab2cc
data/CHANGES.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Stable (3.x)
2
2
 
3
+ 3.0.4
4
+ --------
5
+
6
+ - Raise specific MethodNotFound when service class doesn't respond to (publicly implement)
7
+ the rpc method called from the client. Stop rescuing all NoMethodError's thrown
8
+ by service implementations. [#193, @liveh2o]
9
+
3
10
  3.0.3
4
11
  ---------
5
12
 
@@ -100,6 +107,11 @@ __!! NOTE: These deprecated methods will be removed in v3.1. !!__
100
107
  as an env variable to the client process to ensure the client asks the server
101
108
  if it is alive (able to server requests to clients). [#183, @abrandoned]
102
109
 
110
+ 2.8.13
111
+ ---------
112
+
113
+ - Backport #190 to 2.8 stable series. [#192]
114
+
103
115
  2.8.12
104
116
  ---------
105
117
 
@@ -26,10 +26,12 @@ module Protobuf
26
26
 
27
27
  # Call the given service method.
28
28
  def dispatch_rpc_request
29
+ unless rpc_service.respond_to?(method_name)
30
+ raise MethodNotFound.new("#{service_name}##{method_name} is not a publicly defined method.")
31
+ end
32
+
29
33
  rpc_service.callable_rpc_method(method_name).call
30
34
  rpc_service.response
31
- rescue NoMethodError
32
- raise MethodNotFound.new("#{service_name}##{method_name} is not implemented.")
33
35
  end
34
36
 
35
37
  def method_name
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.0.3'
2
+ VERSION = '3.0.4'
3
3
  end
@@ -6,13 +6,17 @@ describe Protobuf::Rpc::ServiceDispatcher do
6
6
  let(:env) {
7
7
  Protobuf::Rpc::Env.new(
8
8
  'method_name' => method_name,
9
+ 'request' => request,
9
10
  'rpc_service' => service_class,
10
11
  'service_name' => service_name,
11
12
  )
12
13
  }
13
14
  let(:method_name) { :find }
15
+ let(:request) { request_type.new(:name => 'required') }
16
+ let(:request_type) { service_class.rpcs[method_name].request_type }
14
17
  let(:response) { response_type.new(:name => 'required') }
15
18
  let(:response_type) { service_class.rpcs[method_name].response_type }
19
+
16
20
  let(:rpc_service) { service_class.new(env) }
17
21
  let(:service_class) { Test::ResourceService }
18
22
  let(:service_name) { service_class.to_s }
@@ -22,7 +26,6 @@ describe Protobuf::Rpc::ServiceDispatcher do
22
26
  before { subject.stub(:rpc_service).and_return(rpc_service) }
23
27
 
24
28
  describe '#call' do
25
- before { rpc_service.stub(:callable_rpc_method).and_return(lambda {}) }
26
29
  before { rpc_service.stub(:response).and_return(response) }
27
30
 
28
31
  it "dispatches the request" do
@@ -31,11 +34,19 @@ describe Protobuf::Rpc::ServiceDispatcher do
31
34
  end
32
35
 
33
36
  context "when the given RPC method is not implemented" do
34
- before { rpc_service.stub(:callable_rpc_method).and_return(lambda { rpc_service.__send__(:foo) }) }
37
+ let(:method_name) { :find_not_implemented }
35
38
 
36
39
  it "raises a method not found exception" do
37
40
  expect { subject.call(env) }.to raise_exception(Protobuf::Rpc::MethodNotFound)
38
41
  end
39
42
  end
43
+
44
+ context "when the given RPC method is implemented and a NoMethodError is raised" do
45
+ before { rpc_service.stub(:callable_rpc_method).and_return(lambda { rpc_service.__send__(:foo) }) }
46
+
47
+ it "raises the exeception" do
48
+ expect { subject.call(env) }.to raise_exception(NoMethodError)
49
+ end
50
+ end
40
51
  end
41
52
  end
@@ -110,6 +110,7 @@ module Test
110
110
  rpc :find, ::Test::ResourceFindRequest, ::Test::Resource
111
111
  rpc :find_with_rpc_failed, ::Test::ResourceFindRequest, ::Test::Resource
112
112
  rpc :find_with_sleep, ::Test::ResourceSleepRequest, ::Test::Resource
113
+ rpc :find_not_implemented, ::Test::ResourceFindRequest, ::Test::Resource
113
114
  end
114
115
 
115
116
  end
@@ -90,4 +90,5 @@ service ResourceService {
90
90
  rpc Find (ResourceFindRequest) returns (Resource);
91
91
  rpc FindWithRpcFailed (ResourceFindRequest) returns (Resource);
92
92
  rpc FindWithSleep (ResourceSleepRequest) returns (Resource);
93
+ rpc FindNotImplemented (ResourceFindRequest) returns (Resource);
93
94
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - BJ Neilsen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-03-13 00:00:00.000000000 Z
14
+ date: 2014-03-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport