protobuf 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/lib/protobuf/field/base_field.rb +5 -1
  4. data/lib/protobuf/field/float_field.rb +4 -0
  5. data/lib/protobuf/rpc/connectors/zmq.rb +31 -20
  6. data/lib/protobuf/rpc/servers/zmq/broker.rb +1 -1
  7. data/lib/protobuf/version.rb +1 -1
  8. data/protobuf.gemspec +1 -1
  9. data/spec/encoding/all_types_spec.rb +1 -1
  10. data/spec/encoding/extreme_values_spec.rb +0 -0
  11. data/spec/functional/socket_server_spec.rb +5 -4
  12. data/spec/functional/zmq_server_spec.rb +7 -7
  13. data/spec/lib/protobuf/cli_spec.rb +39 -39
  14. data/spec/lib/protobuf/code_generator_spec.rb +4 -4
  15. data/spec/lib/protobuf/enum_spec.rb +23 -23
  16. data/spec/lib/protobuf/field/float_field_spec.rb +55 -0
  17. data/spec/lib/protobuf/field/string_field_spec.rb +4 -4
  18. data/spec/lib/protobuf/generators/base_spec.rb +4 -7
  19. data/spec/lib/protobuf/generators/enum_generator_spec.rb +3 -3
  20. data/spec/lib/protobuf/generators/extension_generator_spec.rb +4 -4
  21. data/spec/lib/protobuf/generators/field_generator_spec.rb +11 -11
  22. data/spec/lib/protobuf/generators/file_generator_spec.rb +3 -3
  23. data/spec/lib/protobuf/generators/service_generator_spec.rb +2 -2
  24. data/spec/lib/protobuf/lifecycle_spec.rb +16 -16
  25. data/spec/lib/protobuf/logger_spec.rb +27 -27
  26. data/spec/lib/protobuf/message_spec.rb +42 -42
  27. data/spec/lib/protobuf/optionable_spec.rb +1 -1
  28. data/spec/lib/protobuf/rpc/client_spec.rb +13 -13
  29. data/spec/lib/protobuf/rpc/connector_spec.rb +4 -4
  30. data/spec/lib/protobuf/rpc/connectors/base_spec.rb +7 -7
  31. data/spec/lib/protobuf/rpc/connectors/common_spec.rb +31 -33
  32. data/spec/lib/protobuf/rpc/connectors/socket_spec.rb +8 -8
  33. data/spec/lib/protobuf/rpc/connectors/zmq_spec.rb +24 -35
  34. data/spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb +8 -8
  35. data/spec/lib/protobuf/rpc/middleware/logger_spec.rb +2 -2
  36. data/spec/lib/protobuf/rpc/middleware/request_decoder_spec.rb +10 -10
  37. data/spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb +6 -6
  38. data/spec/lib/protobuf/rpc/servers/socket_server_spec.rb +3 -3
  39. data/spec/lib/protobuf/rpc/servers/zmq/server_spec.rb +3 -3
  40. data/spec/lib/protobuf/rpc/servers/zmq/util_spec.rb +2 -2
  41. data/spec/lib/protobuf/rpc/servers/zmq/worker_spec.rb +5 -5
  42. data/spec/lib/protobuf/rpc/service_directory_spec.rb +26 -27
  43. data/spec/lib/protobuf/rpc/service_dispatcher_spec.rb +4 -4
  44. data/spec/lib/protobuf/rpc/service_filters_spec.rb +39 -39
  45. data/spec/lib/protobuf/rpc/service_spec.rb +27 -27
  46. data/spec/lib/protobuf/rpc/stat_spec.rb +4 -4
  47. data/spec/lib/protobuf_spec.rb +7 -7
  48. data/spec/spec_helper.rb +1 -0
  49. data/spec/support/packed_field.rb +1 -1
  50. metadata +6 -76
@@ -17,12 +17,12 @@ describe Protobuf::Rpc::Middleware::ResponseEncoder do
17
17
  describe "#call" do
18
18
  it "encodes the response" do
19
19
  stack_env = subject.call(env)
20
- stack_env.encoded_response.should eq encoded_response
20
+ expect(stack_env.encoded_response).to eq encoded_response
21
21
  end
22
22
 
23
23
  it "calls the stack" do
24
24
  stack_env = subject.call(env)
25
- stack_env.response.should eq response
25
+ expect(stack_env.response).to eq response
26
26
  end
27
27
 
28
28
  context "when response is responds to :to_hash" do
@@ -31,7 +31,7 @@ describe Protobuf::Rpc::Middleware::ResponseEncoder do
31
31
 
32
32
  it "sets Env#response" do
33
33
  stack_env = subject.call(env)
34
- stack_env.response.should eq response
34
+ expect(stack_env.response).to eq response
35
35
  end
36
36
  end
37
37
 
@@ -41,7 +41,7 @@ describe Protobuf::Rpc::Middleware::ResponseEncoder do
41
41
 
42
42
  it "sets Env#response" do
43
43
  stack_env = subject.call(env)
44
- stack_env.response.should eq response
44
+ expect(stack_env.response).to eq response
45
45
  end
46
46
  end
47
47
 
@@ -60,12 +60,12 @@ describe Protobuf::Rpc::Middleware::ResponseEncoder do
60
60
 
61
61
  it "wraps and encodes the response" do
62
62
  stack_env = subject.call(env)
63
- stack_env.encoded_response.should eq encoded_response
63
+ expect(stack_env.encoded_response).to eq encoded_response
64
64
  end
65
65
  end
66
66
 
67
67
  context "when encoding fails" do
68
- before { Protobuf::Socketrpc::Response.any_instance.stub(:encode).and_raise(RuntimeError) }
68
+ before { allow_any_instance_of(Protobuf::Socketrpc::Response).to receive(:encode).and_raise(RuntimeError) }
69
69
 
70
70
  it "raises a bad request data exception" do
71
71
  expect { subject.call(env) }.to raise_exception(Protobuf::Rpc::PbError)
@@ -24,15 +24,15 @@ describe Protobuf::Rpc::Socket::Server do
24
24
  end
25
25
 
26
26
  it "Runner provides a stop method" do
27
- @runner.should respond_to(:stop)
27
+ expect(@runner).to respond_to(:stop)
28
28
  end
29
29
 
30
30
  it "provides a stop method" do
31
- @server.should respond_to(:stop)
31
+ expect(@server).to respond_to(:stop)
32
32
  end
33
33
 
34
34
  it "signals the Server is running" do
35
- @server.should be_running
35
+ expect(@server).to be_running
36
36
  end
37
37
 
38
38
  end
@@ -22,12 +22,12 @@ describe Protobuf::Rpc::Zmq::Server do
22
22
  describe '.running?' do
23
23
  it 'returns true if running' do
24
24
  subject.instance_variable_set(:@running, true)
25
- subject.running?.should be_true
25
+ expect(subject.running?).to be_truthy
26
26
  end
27
27
 
28
28
  it 'returns false if not running' do
29
29
  subject.instance_variable_set(:@running, false)
30
- subject.running?.should be_false
30
+ expect(subject.running?).to be_falsey
31
31
  end
32
32
  end
33
33
 
@@ -35,7 +35,7 @@ describe Protobuf::Rpc::Zmq::Server do
35
35
  it 'sets running to false' do
36
36
  subject.instance_variable_set(:@workers, [])
37
37
  subject.stop
38
- subject.instance_variable_get(:@running).should be_false
38
+ expect(subject.instance_variable_get(:@running)).to be_falsey
39
39
  end
40
40
  end
41
41
  end
@@ -18,7 +18,7 @@ describe ::Protobuf::Rpc::Zmq::Util do
18
18
  end
19
19
 
20
20
  it 'retrieves the error string from ZeroMQ' do
21
- ZMQ::Util.stub(:error_string).and_return('an error from zmq')
21
+ allow(ZMQ::Util).to receive(:error_string).and_return('an error from zmq')
22
22
  expect {
23
23
  subject.zmq_error_check(-1, :test)
24
24
  }.to raise_error(RuntimeError, /an error from zmq/i)
@@ -39,7 +39,7 @@ describe ::Protobuf::Rpc::Zmq::Util do
39
39
 
40
40
  describe '#log_signature' do
41
41
  it 'returns the signature for the log' do
42
- subject.log_signature.should include('server', 'UtilTest')
42
+ expect(subject.log_signature).to include('server', 'UtilTest')
43
43
  end
44
44
  end
45
45
 
@@ -1,16 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ::Protobuf::Rpc::Zmq::Worker do
4
- before(:each) do
4
+ before(:each) do
5
5
  load 'protobuf/zmq.rb'
6
6
 
7
7
  fake_socket = double
8
- fake_socket.should_receive(:connect).and_return(0)
9
- fake_socket.should_receive(:send_string).and_return(0)
8
+ expect(fake_socket).to receive(:connect).and_return(0)
9
+ expect(fake_socket).to receive(:send_string).and_return(0)
10
10
 
11
11
  fake_context = double
12
- fake_context.should_receive(:socket).and_return( fake_socket )
13
- ::ZMQ::Context.should_receive(:new).and_return( fake_context )
12
+ expect(fake_context).to receive(:socket).and_return(fake_socket)
13
+ expect(::ZMQ::Context).to receive(:new).and_return(fake_context)
14
14
  end
15
15
 
16
16
  subject do
@@ -56,10 +56,9 @@ describe ::Protobuf::Rpc::ServiceDirectory do
56
56
  end
57
57
 
58
58
  def expect_event_trigger(event)
59
- ::ActiveSupport::Notifications
60
- .should_receive(:instrument)
61
- .with(event, hash_including(:listing => an_instance_of(::Protobuf::Rpc::ServiceDirectory::Listing)))
62
- .once
59
+ expect(::ActiveSupport::Notifications).to receive(:instrument)
60
+ .with(event, hash_including(:listing => an_instance_of(::Protobuf::Rpc::ServiceDirectory::Listing)))
61
+ .once
63
62
  end
64
63
 
65
64
  def send_beacon(type, server)
@@ -74,29 +73,29 @@ describe ::Protobuf::Rpc::ServiceDirectory do
74
73
  end
75
74
 
76
75
  it "should be a singleton" do
77
- subject.should be_a_kind_of(Singleton)
76
+ expect(subject).to be_a_kind_of(Singleton)
78
77
  end
79
78
 
80
79
  it "should be configured to listen to address 127.0.0.1" do
81
- described_class.address.should eq '127.0.0.1'
80
+ expect(described_class.address).to eq '127.0.0.1'
82
81
  end
83
82
 
84
83
  it "should be configured to listen to port 33333" do
85
- described_class.port.should eq 33333
84
+ expect(described_class.port).to eq 33333
86
85
  end
87
86
 
88
87
  it "should defer .start to the instance#start" do
89
- described_class.instance.should_receive(:start)
88
+ expect(described_class.instance).to receive(:start)
90
89
  described_class.start
91
90
  end
92
91
 
93
92
  it "should yeild itself to blocks passed to .start" do
94
- described_class.instance.stub(:start)
93
+ allow(described_class.instance).to receive(:start)
95
94
  expect { |b| described_class.start(&b) }.to yield_with_args(described_class)
96
95
  end
97
96
 
98
97
  it "should defer .stop to the instance#stop" do
99
- described_class.instance.should_receive(:stop)
98
+ expect(described_class.instance).to receive(:stop)
100
99
  described_class.stop
101
100
  end
102
101
 
@@ -106,20 +105,20 @@ describe ::Protobuf::Rpc::ServiceDirectory do
106
105
  describe "#lookup" do
107
106
  it "should return nil" do
108
107
  send_beacon(:heartbeat, echo_server)
109
- subject.lookup("EchoService").should be_nil
108
+ expect(subject.lookup("EchoService")).to be_nil
110
109
  end
111
110
  end
112
111
 
113
112
  describe "#restart" do
114
113
  it "should start the service" do
115
114
  subject.restart
116
- subject.should be_running
115
+ expect(subject).to be_running
117
116
  end
118
117
  end
119
118
 
120
119
  describe "#running" do
121
120
  it "should be false" do
122
- subject.should_not be_running
121
+ expect(subject).to_not be_running
123
122
  end
124
123
  end
125
124
 
@@ -134,7 +133,7 @@ describe ::Protobuf::Rpc::ServiceDirectory do
134
133
  before { subject.start }
135
134
  after { subject.stop }
136
135
 
137
- it { should be_running }
136
+ specify { expect(subject).to be_running }
138
137
 
139
138
  it "should trigger added events" do
140
139
  expect_event_trigger("directory.listing.added")
@@ -159,13 +158,13 @@ describe ::Protobuf::Rpc::ServiceDirectory do
159
158
  send_beacon(:heartbeat, hello_server)
160
159
  send_beacon(:heartbeat, combo_server)
161
160
 
162
- subject.all_listings_for("HelloService").size.should eq(2)
161
+ expect(subject.all_listings_for("HelloService").size).to eq(2)
163
162
  end
164
163
  end
165
164
 
166
165
  context "when no listings are present" do
167
166
  it "returns and empty array" do
168
- subject.all_listings_for("HelloService").size.should eq(0)
167
+ expect(subject.all_listings_for("HelloService").size).to eq(0)
169
168
  end
170
169
  end
171
170
  end
@@ -185,7 +184,7 @@ describe ::Protobuf::Rpc::ServiceDirectory do
185
184
  describe "#lookup" do
186
185
  it "should provide listings by service" do
187
186
  send_beacon(:heartbeat, hello_server)
188
- subject.lookup("HelloService").to_hash.should eq hello_server.to_hash
187
+ expect(subject.lookup("HelloService").to_hash).to eq hello_server.to_hash
189
188
  end
190
189
 
191
190
  it "should return random listings" do
@@ -193,14 +192,14 @@ describe ::Protobuf::Rpc::ServiceDirectory do
193
192
  send_beacon(:heartbeat, combo_server)
194
193
 
195
194
  uuids = 100.times.map { subject.lookup("HelloService").uuid }
196
- uuids.count("hello").should be_within(25).of(50)
197
- uuids.count("combo").should be_within(25).of(50)
195
+ expect(uuids.count("hello")).to be_within(25).of(50)
196
+ expect(uuids.count("combo")).to be_within(25).of(50)
198
197
  end
199
198
 
200
199
  it "should not return expired listings" do
201
200
  send_beacon(:heartbeat, hello_server_with_short_ttl)
202
201
  sleep 1
203
- subject.lookup("HelloService").should be_nil
202
+ expect(subject.lookup("HelloService")).to be_nil
204
203
  end
205
204
 
206
205
  it "should not return flatlined servers" do
@@ -209,7 +208,7 @@ describe ::Protobuf::Rpc::ServiceDirectory do
209
208
  send_beacon(:flatline, echo_server)
210
209
 
211
210
  uuids = 100.times.map { subject.lookup("EchoService").uuid }
212
- uuids.count("combo").should eq 100
211
+ expect(uuids.count("combo")).to eq 100
213
212
  end
214
213
 
215
214
  it "should return up-to-date listings" do
@@ -217,13 +216,13 @@ describe ::Protobuf::Rpc::ServiceDirectory do
217
216
  echo_server.port = "7777"
218
217
  send_beacon(:heartbeat, echo_server)
219
218
 
220
- subject.lookup("EchoService").port.should eq "7777"
219
+ expect(subject.lookup("EchoService").port).to eq "7777"
221
220
  end
222
221
 
223
222
  context 'when given service identifier is a class name' do
224
223
  it 'returns the listing corresponding to the class name' do
225
224
  send_beacon(:heartbeat, echo_server)
226
- subject.lookup(EchoService).uuid.should eq echo_server.uuid
225
+ expect(subject.lookup(EchoService).uuid).to eq echo_server.uuid
227
226
  end
228
227
  end
229
228
  end
@@ -233,13 +232,13 @@ describe ::Protobuf::Rpc::ServiceDirectory do
233
232
  send_beacon(:heartbeat, echo_server)
234
233
  send_beacon(:heartbeat, combo_server)
235
234
  subject.restart
236
- subject.lookup("EchoService").should be_nil
235
+ expect(subject.lookup("EchoService")).to be_nil
237
236
  end
238
237
  end
239
238
 
240
239
  describe "#running" do
241
240
  it "should be true" do
242
- subject.should be_running
241
+ expect(subject).to be_running
243
242
  end
244
243
  end
245
244
 
@@ -248,12 +247,12 @@ describe ::Protobuf::Rpc::ServiceDirectory do
248
247
  send_beacon(:heartbeat, echo_server)
249
248
  send_beacon(:heartbeat, combo_server)
250
249
  subject.stop
251
- subject.lookup("EchoService").should be_nil
250
+ expect(subject.lookup("EchoService")).to be_nil
252
251
  end
253
252
 
254
253
  it "should stop the server" do
255
254
  subject.stop
256
- subject.should_not be_running
255
+ expect(subject).to_not be_running
257
256
  end
258
257
  end
259
258
  end
@@ -23,14 +23,14 @@ describe Protobuf::Rpc::ServiceDispatcher do
23
23
 
24
24
  subject { described_class.new(app) }
25
25
 
26
- before { subject.stub(:rpc_service).and_return(rpc_service) }
26
+ before { allow(subject).to receive(:rpc_service).and_return(rpc_service) }
27
27
 
28
28
  describe '#call' do
29
- before { rpc_service.stub(:response).and_return(response) }
29
+ before { allow(rpc_service).to receive(:response).and_return(response) }
30
30
 
31
31
  it "dispatches the request" do
32
32
  stack_env = subject.call(env)
33
- stack_env.response.should eq response
33
+ expect(stack_env.response).to eq response
34
34
  end
35
35
 
36
36
  context "when the given RPC method is not implemented" do
@@ -42,7 +42,7 @@ describe Protobuf::Rpc::ServiceDispatcher do
42
42
  end
43
43
 
44
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) }) }
45
+ before { allow(rpc_service).to receive(:callable_rpc_method).and_return(lambda { rpc_service.__send__(:foo) }) }
46
46
 
47
47
  it "raises the exeception" do
48
48
  expect { subject.call(env) }.to raise_exception(NoMethodError)
@@ -55,13 +55,13 @@ describe Protobuf::Rpc::ServiceFilters do
55
55
  FilterTest.before_filter(:foo)
56
56
  end
57
57
 
58
- specify { subject.class.should respond_to(:before_filter) }
59
- specify { subject.class.should respond_to(:before_action) }
58
+ specify { expect(subject.class).to respond_to(:before_filter) }
59
+ specify { expect(subject.class).to respond_to(:before_action) }
60
60
 
61
61
  it 'calls filters in the order they were defined' do
62
62
  subject.__send__(:run_filters, :endpoint)
63
- subject.called.should eq [ :verify_before, :foo, :endpoint ]
64
- subject.before_filter_calls.should eq 1
63
+ expect(subject.called).to eq [ :verify_before, :foo, :endpoint ]
64
+ expect(subject.before_filter_calls).to eq 1
65
65
  end
66
66
 
67
67
  context 'when filter is configured with "only"' do
@@ -82,14 +82,14 @@ describe Protobuf::Rpc::ServiceFilters do
82
82
  context 'when invoking a method defined in "only" option' do
83
83
  it 'invokes the filter' do
84
84
  subject.__send__(:run_filters, :endpoint_with_verify)
85
- subject.called.should eq [ :verify_before, :endpoint_with_verify ]
85
+ expect(subject.called).to eq [ :verify_before, :endpoint_with_verify ]
86
86
  end
87
87
  end
88
88
 
89
89
  context 'when invoking a method not defined by "only" option' do
90
90
  it 'does not invoke the filter' do
91
91
  subject.__send__(:run_filters, :endpoint)
92
- subject.called.should eq [ :endpoint ]
92
+ expect(subject.called).to eq [ :endpoint ]
93
93
  end
94
94
  end
95
95
  end
@@ -112,14 +112,14 @@ describe Protobuf::Rpc::ServiceFilters do
112
112
  context 'when invoking a method not defined in "except" option' do
113
113
  it 'invokes the filter' do
114
114
  subject.__send__(:run_filters, :endpoint)
115
- subject.called.should eq [ :verify_before, :endpoint ]
115
+ expect(subject.called).to eq [ :verify_before, :endpoint ]
116
116
  end
117
117
  end
118
118
 
119
119
  context 'when invoking a method defined by "except" option' do
120
120
  it 'does not invoke the filter' do
121
121
  subject.__send__(:run_filters, :endpoint_without_verify)
122
- subject.called.should eq [ :endpoint_without_verify ]
122
+ expect(subject.called).to eq [ :endpoint_without_verify ]
123
123
  end
124
124
  end
125
125
  end
@@ -142,7 +142,7 @@ describe Protobuf::Rpc::ServiceFilters do
142
142
 
143
143
  it 'invokes the filter' do
144
144
  subject.__send__(:run_filters, :endpoint)
145
- subject.called.should eq [ :verify_before, :endpoint ]
145
+ expect(subject.called).to eq [ :verify_before, :endpoint ]
146
146
  end
147
147
  end
148
148
 
@@ -154,7 +154,7 @@ describe Protobuf::Rpc::ServiceFilters do
154
154
 
155
155
  it 'invokes the filter' do
156
156
  subject.__send__(:run_filters, :endpoint)
157
- subject.called.should eq [ :verify_before, :endpoint ]
157
+ expect(subject.called).to eq [ :verify_before, :endpoint ]
158
158
  end
159
159
  end
160
160
 
@@ -166,7 +166,7 @@ describe Protobuf::Rpc::ServiceFilters do
166
166
 
167
167
  it 'skips the filter' do
168
168
  subject.__send__(:run_filters, :endpoint)
169
- subject.called.should eq [ :endpoint ]
169
+ expect(subject.called).to eq [ :endpoint ]
170
170
  end
171
171
  end
172
172
 
@@ -178,7 +178,7 @@ describe Protobuf::Rpc::ServiceFilters do
178
178
 
179
179
  it 'skips the filter' do
180
180
  subject.__send__(:run_filters, :endpoint)
181
- subject.called.should eq [ :endpoint ]
181
+ expect(subject.called).to eq [ :endpoint ]
182
182
  end
183
183
  end
184
184
  end
@@ -201,7 +201,7 @@ describe Protobuf::Rpc::ServiceFilters do
201
201
 
202
202
  it 'invokes the filter' do
203
203
  subject.__send__(:run_filters, :endpoint)
204
- subject.called.should eq [ :verify_before, :endpoint ]
204
+ expect(subject.called).to eq [ :verify_before, :endpoint ]
205
205
  end
206
206
  end
207
207
 
@@ -213,7 +213,7 @@ describe Protobuf::Rpc::ServiceFilters do
213
213
 
214
214
  it 'invokes the filter' do
215
215
  subject.__send__(:run_filters, :endpoint)
216
- subject.called.should eq [ :verify_before, :endpoint ]
216
+ expect(subject.called).to eq [ :verify_before, :endpoint ]
217
217
  end
218
218
  end
219
219
 
@@ -225,7 +225,7 @@ describe Protobuf::Rpc::ServiceFilters do
225
225
 
226
226
  it 'skips the filter' do
227
227
  subject.__send__(:run_filters, :endpoint)
228
- subject.called.should eq [ :endpoint ]
228
+ expect(subject.called).to eq [ :endpoint ]
229
229
  end
230
230
  end
231
231
 
@@ -237,7 +237,7 @@ describe Protobuf::Rpc::ServiceFilters do
237
237
 
238
238
  it 'skips the filter' do
239
239
  subject.__send__(:run_filters, :endpoint)
240
- subject.called.should eq [ :endpoint ]
240
+ expect(subject.called).to eq [ :endpoint ]
241
241
  end
242
242
  end
243
243
  end
@@ -259,9 +259,9 @@ describe Protobuf::Rpc::ServiceFilters do
259
259
  end
260
260
 
261
261
  it 'does not invoke the rpc method' do
262
- subject.should_not_receive(:endpoint)
262
+ expect(subject).not_to receive(:endpoint)
263
263
  subject.__send__(:run_filters, :endpoint)
264
- subject.called.should eq [ :short_circuit_filter ]
264
+ expect(subject.called).to eq [ :short_circuit_filter ]
265
265
  end
266
266
  end
267
267
  end
@@ -289,13 +289,13 @@ describe Protobuf::Rpc::ServiceFilters do
289
289
  FilterTest.after_filter(:foo)
290
290
  end
291
291
 
292
- specify { subject.class.should respond_to(:after_filter) }
293
- specify { subject.class.should respond_to(:after_action) }
292
+ specify { expect(subject.class).to respond_to(:after_filter) }
293
+ specify { expect(subject.class).to respond_to(:after_action) }
294
294
 
295
295
  it 'calls filters in the order they were defined' do
296
296
  subject.__send__(:run_filters, :endpoint)
297
- subject.called.should eq [ :endpoint, :verify_after, :foo ]
298
- subject.after_filter_calls.should eq 1
297
+ expect(subject.called).to eq [ :endpoint, :verify_after, :foo ]
298
+ expect(subject.after_filter_calls).to eq 1
299
299
  end
300
300
  end
301
301
 
@@ -326,12 +326,12 @@ describe Protobuf::Rpc::ServiceFilters do
326
326
  FilterTest.around_filter(:inner_around)
327
327
  end
328
328
 
329
- specify { subject.class.should respond_to(:around_filter) }
330
- specify { subject.class.should respond_to(:around_action) }
329
+ specify { expect(subject.class).to respond_to(:around_filter) }
330
+ specify { expect(subject.class).to respond_to(:around_action) }
331
331
 
332
332
  it 'calls filters in the order they were defined' do
333
333
  subject.__send__(:run_filters, :endpoint)
334
- subject.called.should eq([ :outer_around_top,
334
+ expect(subject.called).to eq([ :outer_around_top,
335
335
  :inner_around_top,
336
336
  :endpoint,
337
337
  :inner_around_bottom,
@@ -354,9 +354,9 @@ describe Protobuf::Rpc::ServiceFilters do
354
354
  end
355
355
 
356
356
  it 'cancels calling the rest of the filters and the endpoint' do
357
- subject.should_not_receive(:endpoint)
357
+ expect(subject).not_to receive(:endpoint)
358
358
  subject.__send__(:run_filters, :endpoint)
359
- subject.called.should eq([ :outer_around_top,
359
+ expect(subject.called).to eq([ :outer_around_top,
360
360
  :inner_around,
361
361
  :outer_around_bottom ])
362
362
  end
@@ -412,10 +412,10 @@ describe Protobuf::Rpc::ServiceFilters do
412
412
 
413
413
  it 'short-circuits the call stack' do
414
414
  expect {
415
- subject.should_not_receive(:endpoint)
415
+ expect(subject).not_to receive(:endpoint)
416
416
  subject.__send__(:run_filters, :endpoint)
417
- subject.called.should eq([ :filter_with_error3, :custom_error_occurred ])
418
- subject.ex_class.should eq CustomError3
417
+ expect(subject.called).to eq([ :filter_with_error3, :custom_error_occurred ])
418
+ expect(subject.ex_class).to eq CustomError3
419
419
  }.not_to raise_error
420
420
  end
421
421
  end
@@ -433,10 +433,10 @@ describe Protobuf::Rpc::ServiceFilters do
433
433
 
434
434
  it 'short-circuits the call stack' do
435
435
  expect {
436
- subject.should_not_receive(:endpoint)
436
+ expect(subject).not_to receive(:endpoint)
437
437
  subject.__send__(:run_filters, :endpoint)
438
- subject.called.should eq([ :filter_with_error1, :custom_error_occurred ])
439
- subject.ex_class.should eq CustomError1
438
+ expect(subject.called).to eq([ :filter_with_error1, :custom_error_occurred ])
439
+ expect(subject.ex_class).to eq CustomError1
440
440
  }.not_to raise_error
441
441
  end
442
442
  end
@@ -453,10 +453,10 @@ describe Protobuf::Rpc::ServiceFilters do
453
453
 
454
454
  it 'short-circuits the call stack' do
455
455
  expect {
456
- subject.should_not_receive(:endpoint)
456
+ expect(subject).not_to receive(:endpoint)
457
457
  subject.__send__(:run_filters, :endpoint)
458
- subject.called.should eq([ :filter_with_error1, :block_rescue_handler ])
459
- subject.ex_class.should eq CustomError1
458
+ expect(subject.called).to eq([ :filter_with_error1, :block_rescue_handler ])
459
+ expect(subject.ex_class).to eq CustomError1
460
460
  }.not_to raise_error
461
461
  end
462
462
  end
@@ -472,10 +472,10 @@ describe Protobuf::Rpc::ServiceFilters do
472
472
 
473
473
  it 'rescues with the given callable' do
474
474
  expect {
475
- subject.should_not_receive(:endpoint)
475
+ expect(subject).not_to receive(:endpoint)
476
476
  subject.__send__(:run_filters, :endpoint)
477
- subject.called.should eq([ :filter_with_runtime_error, :standard_error_rescue_handler ])
478
- subject.ex_class.should eq RuntimeError
477
+ expect(subject.called).to eq([ :filter_with_runtime_error, :standard_error_rescue_handler ])
478
+ expect(subject.ex_class).to eq RuntimeError
479
479
  }.not_to raise_error
480
480
  end
481
481
  end