amq-protocol 1.9.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/ChangeLog.md +15 -1
- data/Gemfile +3 -2
- data/LICENSE +1 -1
- data/README.md +7 -4
- data/amq-protocol.gemspec +5 -7
- data/lib/amq/protocol/constants.rb +1 -0
- data/lib/amq/protocol/table_value_encoder.rb +4 -4
- data/lib/amq/protocol/version.rb +1 -1
- data/lib/amq/uri.rb +3 -5
- data/spec/amq/bit_set_spec.rb +40 -40
- data/spec/amq/int_allocator_spec.rb +25 -25
- data/spec/amq/pack_spec.rb +5 -5
- data/spec/amq/protocol/basic_spec.rb +58 -58
- data/spec/amq/protocol/blank_body_encoding_spec.rb +2 -2
- data/spec/amq/protocol/channel_spec.rb +22 -22
- data/spec/amq/protocol/confirm_spec.rb +5 -5
- data/spec/amq/protocol/connection_spec.rb +21 -21
- data/spec/amq/protocol/constants_spec.rb +4 -4
- data/spec/amq/protocol/exchange_spec.rb +10 -10
- data/spec/amq/protocol/frame_spec.rb +18 -18
- data/spec/amq/protocol/method_spec.rb +8 -8
- data/spec/amq/protocol/queue_spec.rb +15 -15
- data/spec/amq/protocol/table_spec.rb +50 -57
- data/spec/amq/protocol/tx_spec.rb +6 -6
- data/spec/amq/protocol/value_decoder_spec.rb +18 -18
- data/spec/amq/protocol/value_encoder_spec.rb +41 -41
- data/spec/amq/protocol_spec.rb +174 -174
- data/spec/amq/settings_spec.rb +4 -4
- data/spec/amq/uri_parsing_spec.rb +33 -33
- data/spec/spec_helper.rb +2 -9
- metadata +14 -16
data/spec/amq/pack_spec.rb
CHANGED
@@ -14,7 +14,7 @@ module AMQ
|
|
14
14
|
|
15
15
|
it "unpacks signed integers from a string to a number" do
|
16
16
|
examples_16bit.each do |key, value|
|
17
|
-
described_class.unpack_int16_big_endian(value)[0].
|
17
|
+
expect(described_class.unpack_int16_big_endian(value)[0]).to eq(key)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -37,13 +37,13 @@ module AMQ
|
|
37
37
|
|
38
38
|
it "packs integers into big-endian string" do
|
39
39
|
examples.each do |key, value|
|
40
|
-
described_class.pack_uint64_big_endian(key).
|
40
|
+
expect(described_class.pack_uint64_big_endian(key)).to eq(value)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should unpack string representation into integer" do
|
45
45
|
examples.each do |key, value|
|
46
|
-
described_class.unpack_uint64_big_endian(value)[0].
|
46
|
+
expect(described_class.unpack_uint64_big_endian(value)[0]).to eq(key)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -59,13 +59,13 @@ module AMQ
|
|
59
59
|
|
60
60
|
it "packs integers into big-endian string" do
|
61
61
|
examples.each do |key, value|
|
62
|
-
described_class.pack_uint64_big_endian(key).
|
62
|
+
expect(described_class.pack_uint64_big_endian(key)).to eq(value)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should unpack string representation into integer" do
|
67
67
|
examples.each do |key, value|
|
68
|
-
described_class.unpack_uint64_big_endian(value)[0].
|
68
|
+
expect(described_class.unpack_uint64_big_endian(value)[0]).to eq(key)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -8,58 +8,58 @@ module AMQ
|
|
8
8
|
describe Basic do
|
9
9
|
describe '.encode_timestamp' do
|
10
10
|
it 'encodes the timestamp as a 64 byte big endian integer' do
|
11
|
-
Basic.encode_timestamp(12345).last.
|
11
|
+
expect(Basic.encode_timestamp(12345).last).to eq("\x00\x00\x00\x00\x00\x0009")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
# describe '.decode_timestamp' do
|
16
16
|
# it 'decodes the timestamp from a 64 byte big endian integer and returns a Time object' do
|
17
|
-
# Basic.decode_timestamp("\x00\x00\x00\x00\x00\x0009").
|
17
|
+
# expect(Basic.decode_timestamp("\x00\x00\x00\x00\x00\x0009")).to eq(Time.at(12345))
|
18
18
|
# end
|
19
19
|
# end
|
20
20
|
|
21
21
|
describe '.encode_headers' do
|
22
22
|
it 'encodes the headers as a table' do
|
23
|
-
Basic.encode_headers(:hello => 'world').last.
|
23
|
+
expect(Basic.encode_headers(:hello => 'world').last).to eq("\x00\x00\x00\x10\x05helloS\x00\x00\x00\x05world")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
# describe '.decode_headers' do
|
28
28
|
# it 'decodes the headers from a table' do
|
29
|
-
# Basic.decode_headers("\x00\x00\x00\x10\x05helloS\x00\x00\x00\x05world").
|
29
|
+
# expect(Basic.decode_headers("\x00\x00\x00\x10\x05helloS\x00\x00\x00\x05world")).to eq({'hello' => 'world'})
|
30
30
|
# end
|
31
31
|
# end
|
32
32
|
|
33
33
|
describe '.encode_properties' do
|
34
34
|
it 'packs the parameters into a byte array using the other encode_* methods' do
|
35
35
|
result = Basic.encode_properties(10, {:priority => 0, :delivery_mode => 2, :content_type => 'application/octet-stream'})
|
36
|
-
result.
|
36
|
+
expect(result).to eq("\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x98\x00\x18application/octet-stream\x02\x00")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe '.decode_properties' do
|
41
41
|
it 'unpacks the properties from a byte array using the decode_* methods' do
|
42
42
|
result = Basic.decode_properties("\x98@\x18application/octet-stream\x02\x00\x00\x00\x00\x00\x00\x00\x00{")
|
43
|
-
result.
|
43
|
+
expect(result).to eq({:priority => 0, :delivery_mode => 2, :content_type => 'application/octet-stream', :timestamp => Time.at(123)})
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'unpacks the properties from a byte array using the decode_* methods, including a table' do
|
47
47
|
result = Basic.decode_properties("\xB8@\x18application/octet-stream\x00\x00\x00\x10\x05helloS\x00\x00\x00\x05world\x02\x00\x00\x00\x00\x00\x00\x00\x00{")
|
48
|
-
result.
|
48
|
+
expect(result).to eq({:priority => 0, :delivery_mode => 2, :content_type => 'application/octet-stream', :timestamp => Time.at(123), :headers => {'hello' => 'world'}})
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
%w(content_type content_encoding correlation_id reply_to expiration message_id type user_id app_id cluster_id).each do |method|
|
53
53
|
describe ".encode_#{method}" do
|
54
54
|
it 'encodes the parameter as a Pascal string' do
|
55
|
-
Basic.send("encode_#{method}", 'hello world').last.
|
55
|
+
expect(Basic.send("encode_#{method}", 'hello world').last).to eq("\x0bhello world")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
# describe ".decode_#{method}" do
|
60
60
|
# it 'returns the string' do
|
61
61
|
# # the length has been stripped in .decode_properties
|
62
|
-
# Basic.send("decode_#{method}", 'hello world').
|
62
|
+
# expect(Basic.send("decode_#{method}", 'hello world')).to eq('hello world')
|
63
63
|
# end
|
64
64
|
# end
|
65
65
|
end
|
@@ -67,13 +67,13 @@ module AMQ
|
|
67
67
|
%w(delivery_mode priority).each do |method|
|
68
68
|
describe ".encode_#{method}" do
|
69
69
|
it 'encodes the parameter as a char' do
|
70
|
-
Basic.send("encode_#{method}", 10).last.
|
70
|
+
expect(Basic.send("encode_#{method}", 10).last).to eq("\x0a")
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
# describe ".decode_#{method}" do
|
75
75
|
# it 'decodes the value from a char' do
|
76
|
-
# Basic.send("decode_#{method}", "\x10").
|
76
|
+
# expect(Basic.send("decode_#{method}", "\x10")).to eq(16)
|
77
77
|
# end
|
78
78
|
# end
|
79
79
|
end
|
@@ -88,8 +88,8 @@ module AMQ
|
|
88
88
|
prefetch_count = 5
|
89
89
|
global = false
|
90
90
|
method_frame = Qos.encode(channel, prefetch_size, prefetch_count, global)
|
91
|
-
method_frame.payload.
|
92
|
-
method_frame.channel.
|
91
|
+
expect(method_frame.payload).to eq("\x00<\x00\n\x00\x00\x00\x03\x00\x05\x00")
|
92
|
+
expect(method_frame.channel).to eq(1)
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -111,8 +111,8 @@ module AMQ
|
|
111
111
|
nowait = false
|
112
112
|
arguments = nil
|
113
113
|
method_frame = Consume.encode(channel, queue, consumer_tag, no_local, no_ack, exclusive, nowait, arguments)
|
114
|
-
method_frame.payload.
|
115
|
-
method_frame.channel.
|
114
|
+
expect(method_frame.payload).to eq("\x00<\x00\x14\x00\x00\x03foo\x02me\x04\x00\x00\x00\x00")
|
115
|
+
expect(method_frame.channel).to eq(1)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -123,7 +123,7 @@ module AMQ
|
|
123
123
|
ConsumeOk.decode("\x03foo")
|
124
124
|
end
|
125
125
|
|
126
|
-
its(:consumer_tag) { should
|
126
|
+
its(:consumer_tag) { should eq('foo') }
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -134,8 +134,8 @@ module AMQ
|
|
134
134
|
consumer_tag = 'foo'
|
135
135
|
nowait = true
|
136
136
|
method_frame = Cancel.encode(channel, consumer_tag, nowait)
|
137
|
-
method_frame.payload.
|
138
|
-
method_frame.channel.
|
137
|
+
expect(method_frame.payload).to eq("\x00<\x00\x1E\x03foo\x01")
|
138
|
+
expect(method_frame.channel).to eq(1)
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -144,7 +144,7 @@ module AMQ
|
|
144
144
|
CancelOk.decode("\x03foo\x01")
|
145
145
|
end
|
146
146
|
|
147
|
-
its(:consumer_tag) { should
|
147
|
+
its(:consumer_tag) { should eq('foo') }
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -154,7 +154,7 @@ module AMQ
|
|
154
154
|
CancelOk.decode("\x03foo")
|
155
155
|
end
|
156
156
|
|
157
|
-
its(:consumer_tag) { should
|
157
|
+
its(:consumer_tag) { should eq('foo') }
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
@@ -170,13 +170,13 @@ module AMQ
|
|
170
170
|
immediate = true
|
171
171
|
frame_size = 512
|
172
172
|
method_frames = Publish.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size)
|
173
|
-
method_frames[0].payload.
|
174
|
-
method_frames[1].payload.
|
175
|
-
method_frames[2].payload.
|
176
|
-
method_frames[0].channel.
|
177
|
-
method_frames[1].channel.
|
178
|
-
method_frames[2].channel.
|
179
|
-
method_frames.
|
173
|
+
expect(method_frames[0].payload).to eq("\x00<\x00(\x00\x00\x03foo\x03xyz\x02")
|
174
|
+
expect(method_frames[1].payload).to eq("\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\f\x88\x00\x18application/octet-stream\x00")
|
175
|
+
expect(method_frames[2].payload).to eq("Hello World!")
|
176
|
+
expect(method_frames[0].channel).to eq(1)
|
177
|
+
expect(method_frames[1].channel).to eq(1)
|
178
|
+
expect(method_frames[2].channel).to eq(1)
|
179
|
+
expect(method_frames.size).to eq(3)
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
@@ -187,10 +187,10 @@ module AMQ
|
|
187
187
|
Return.decode("\x019\fNO_CONSUMERS\namq.fanout\x00")
|
188
188
|
end
|
189
189
|
|
190
|
-
its(:reply_code) { should
|
191
|
-
its(:reply_text) { should
|
192
|
-
its(:exchange) { should
|
193
|
-
its(:routing_key) { should
|
190
|
+
its(:reply_code) { should eq(313) }
|
191
|
+
its(:reply_text) { should eq('NO_CONSUMERS') }
|
192
|
+
its(:exchange) { should eq('amq.fanout') }
|
193
|
+
its(:routing_key) { should eq('') }
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
@@ -200,11 +200,11 @@ module AMQ
|
|
200
200
|
Deliver.decode("\e-1300560114000-445586772970\x00\x00\x00\x00\x00\x00\x00c\x00\namq.fanout\x00")
|
201
201
|
end
|
202
202
|
|
203
|
-
its(:consumer_tag) { should
|
204
|
-
its(:delivery_tag) { should
|
205
|
-
its(:redelivered) { should
|
206
|
-
its(:exchange) { should
|
207
|
-
its(:routing_key) { should
|
203
|
+
its(:consumer_tag) { should eq('-1300560114000-445586772970') }
|
204
|
+
its(:delivery_tag) { should eq(99) }
|
205
|
+
its(:redelivered) { should eq(false) }
|
206
|
+
its(:exchange) { should eq('amq.fanout') }
|
207
|
+
its(:routing_key) { should eq('') }
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
@@ -215,8 +215,8 @@ module AMQ
|
|
215
215
|
queue = 'foo'
|
216
216
|
no_ack = true
|
217
217
|
method_frame = Get.encode(channel, queue, no_ack)
|
218
|
-
method_frame.payload.
|
219
|
-
method_frame.channel.
|
218
|
+
expect(method_frame.payload).to eq("\x00\x3c\x00\x46\x00\x00\x03foo\x01")
|
219
|
+
expect(method_frame.channel).to eq(1)
|
220
220
|
end
|
221
221
|
end
|
222
222
|
end
|
@@ -227,11 +227,11 @@ module AMQ
|
|
227
227
|
GetOk.decode("\x00\x00\x00\x00\x00\x00\x00\x06\x00\namq.fanout\x00\x00\x00\x00^")
|
228
228
|
end
|
229
229
|
|
230
|
-
its(:delivery_tag) { should
|
231
|
-
its(:redelivered) { should
|
232
|
-
its(:exchange) { should
|
233
|
-
its(:routing_key) { should
|
234
|
-
its(:message_count) { should
|
230
|
+
its(:delivery_tag) { should eq(6) }
|
231
|
+
its(:redelivered) { should eq(false) }
|
232
|
+
its(:exchange) { should eq('amq.fanout') }
|
233
|
+
its(:routing_key) { should eq('') }
|
234
|
+
its(:message_count) { should eq(94) }
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
@@ -241,7 +241,7 @@ module AMQ
|
|
241
241
|
GetEmpty.decode("\x03foo")
|
242
242
|
end
|
243
243
|
|
244
|
-
its(:cluster_id) { should
|
244
|
+
its(:cluster_id) { should eq('foo') }
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
@@ -252,8 +252,8 @@ module AMQ
|
|
252
252
|
delivery_tag = 6
|
253
253
|
multiple = false
|
254
254
|
method_frame = Ack.encode(channel, delivery_tag, multiple)
|
255
|
-
method_frame.payload.
|
256
|
-
method_frame.channel.
|
255
|
+
expect(method_frame.payload).to eq("\x00<\x00P\x00\x00\x00\x00\x00\x00\x00\x06\x00")
|
256
|
+
expect(method_frame.channel).to eq(1)
|
257
257
|
end
|
258
258
|
end
|
259
259
|
end
|
@@ -265,8 +265,8 @@ module AMQ
|
|
265
265
|
delivery_tag = 8
|
266
266
|
requeue = true
|
267
267
|
method_frame = Reject.encode(channel, delivery_tag, requeue)
|
268
|
-
method_frame.payload.
|
269
|
-
method_frame.channel.
|
268
|
+
expect(method_frame.payload).to eq("\x00<\x00Z\x00\x00\x00\x00\x00\x00\x00\x08\x01")
|
269
|
+
expect(method_frame.channel).to eq(1)
|
270
270
|
end
|
271
271
|
end
|
272
272
|
end
|
@@ -277,8 +277,8 @@ module AMQ
|
|
277
277
|
channel = 1
|
278
278
|
requeue = true
|
279
279
|
method_frame = RecoverAsync.encode(channel, requeue)
|
280
|
-
method_frame.payload.
|
281
|
-
method_frame.channel.
|
280
|
+
expect(method_frame.payload).to eq("\x00<\x00d\x01")
|
281
|
+
expect(method_frame.channel).to eq(1)
|
282
282
|
end
|
283
283
|
end
|
284
284
|
end
|
@@ -289,8 +289,8 @@ module AMQ
|
|
289
289
|
channel = 1
|
290
290
|
requeue = true
|
291
291
|
method_frame = Recover.encode(channel, requeue)
|
292
|
-
method_frame.payload.
|
293
|
-
method_frame.channel.
|
292
|
+
expect(method_frame.payload).to eq("\x00<\x00n\x01")
|
293
|
+
expect(method_frame.channel).to eq(1)
|
294
294
|
end
|
295
295
|
end
|
296
296
|
end
|
@@ -306,9 +306,9 @@ module AMQ
|
|
306
306
|
Nack.decode("\x00\x00\x00\x00\x00\x00\x00\x09\x03")
|
307
307
|
end
|
308
308
|
|
309
|
-
its(:delivery_tag) { should
|
310
|
-
its(:multiple) { should
|
311
|
-
its(:requeue) { should
|
309
|
+
its(:delivery_tag) { should eq(9) }
|
310
|
+
its(:multiple) { should eq(true) }
|
311
|
+
its(:requeue) { should eq(true) }
|
312
312
|
end
|
313
313
|
|
314
314
|
describe '.encode' do
|
@@ -318,11 +318,11 @@ module AMQ
|
|
318
318
|
multiple = false
|
319
319
|
requeue = true
|
320
320
|
method_frame = Nack.encode(channel, delivery_tag, multiple, requeue)
|
321
|
-
method_frame.payload.
|
322
|
-
method_frame.channel.
|
321
|
+
expect(method_frame.payload).to eq("\x00<\x00x\x00\x00\x00\x00\x00\x00\x00\x0a\x02")
|
322
|
+
expect(method_frame.channel).to eq(1)
|
323
323
|
end
|
324
324
|
end
|
325
325
|
end
|
326
326
|
end
|
327
327
|
end
|
328
|
-
end
|
328
|
+
end
|
@@ -5,10 +5,10 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|
5
5
|
|
6
6
|
describe AMQ::Protocol::Method, ".encode_body" do
|
7
7
|
it "encodes 1-byte long payload as exactly 1 body frame" do
|
8
|
-
described_class.encode_body('1', 1, 65536).size.
|
8
|
+
expect(described_class.encode_body('1', 1, 65536).size).to eq(1)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "encodes 0-byte long (blank) payload as exactly 0 body frame" do
|
12
|
-
described_class.encode_body('', 1, 65536).size.
|
12
|
+
expect(described_class.encode_body('', 1, 65536).size).to eq(0)
|
13
13
|
end
|
14
14
|
end
|
@@ -12,8 +12,8 @@ module AMQ
|
|
12
12
|
channel = 1
|
13
13
|
out_of_band = ''
|
14
14
|
method_frame = Open.encode(channel, out_of_band)
|
15
|
-
method_frame.payload.
|
16
|
-
method_frame.channel.
|
15
|
+
expect(method_frame.payload).to eq("\x00\x14\x00\n\x00")
|
16
|
+
expect(method_frame.channel).to eq(1)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -24,7 +24,7 @@ module AMQ
|
|
24
24
|
OpenOk.decode("\x00\x00\x00\x03foo")
|
25
25
|
end
|
26
26
|
|
27
|
-
its(:channel_id) { should
|
27
|
+
its(:channel_id) { should eq('foo') }
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -34,7 +34,7 @@ module AMQ
|
|
34
34
|
Flow.decode("\x01")
|
35
35
|
end
|
36
36
|
|
37
|
-
its(:active) { should
|
37
|
+
its(:active) { should be_truthy }
|
38
38
|
end
|
39
39
|
|
40
40
|
describe '.encode' do
|
@@ -42,8 +42,8 @@ module AMQ
|
|
42
42
|
channel = 1
|
43
43
|
active = true
|
44
44
|
method_frame = Flow.encode(channel, active)
|
45
|
-
method_frame.payload.
|
46
|
-
method_frame.channel.
|
45
|
+
expect(method_frame.payload).to eq("\x00\x14\x00\x14\x01")
|
46
|
+
expect(method_frame.channel).to eq(1)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -54,7 +54,7 @@ module AMQ
|
|
54
54
|
FlowOk.decode("\x00")
|
55
55
|
end
|
56
56
|
|
57
|
-
its(:active) { should
|
57
|
+
its(:active) { should be_falsey }
|
58
58
|
end
|
59
59
|
|
60
60
|
describe '.encode' do
|
@@ -62,8 +62,8 @@ module AMQ
|
|
62
62
|
channel = 1
|
63
63
|
active = true
|
64
64
|
method_frame = FlowOk.encode(channel, active)
|
65
|
-
method_frame.payload.
|
66
|
-
method_frame.channel.
|
65
|
+
expect(method_frame.payload).to eq("\x00\x14\x00\x15\x01")
|
66
|
+
expect(method_frame.channel).to eq(1)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -75,10 +75,10 @@ module AMQ
|
|
75
75
|
Close.decode("\x00\xc8\x07KTHXBAI\x00\x05\x00\x06")
|
76
76
|
end
|
77
77
|
|
78
|
-
its(:reply_code) { should
|
79
|
-
its(:reply_text) { should
|
80
|
-
its(:class_id) { should
|
81
|
-
its(:method_id) { should
|
78
|
+
its(:reply_code) { should eq(200) }
|
79
|
+
its(:reply_text) { should eq('KTHXBAI') }
|
80
|
+
its(:class_id) { should eq(5) }
|
81
|
+
its(:method_id) { should eq(6) }
|
82
82
|
end
|
83
83
|
|
84
84
|
|
@@ -88,10 +88,10 @@ module AMQ
|
|
88
88
|
Close.decode(raw)
|
89
89
|
end
|
90
90
|
|
91
|
-
its(:reply_code) { should
|
92
|
-
its(:reply_text) { should
|
93
|
-
its(:class_id) { should
|
94
|
-
its(:method_id) { should
|
91
|
+
its(:reply_code) { should eq(404) }
|
92
|
+
its(:reply_text) { should eq(%q{NOT_FOUND - no binding 123456789012345678901234567890123 between exchange 'amq.topic' in vhost '/' and queue 'test' in vhost '/'}) }
|
93
|
+
its(:class_id) { should eq(50) }
|
94
|
+
its(:method_id) { should eq(50) }
|
95
95
|
end
|
96
96
|
|
97
97
|
context 'with an error code' do
|
@@ -109,8 +109,8 @@ module AMQ
|
|
109
109
|
class_id = 0
|
110
110
|
method_id = 0
|
111
111
|
method_frame = Close.encode(channel, reply_code, reply_text, class_id, method_id)
|
112
|
-
method_frame.payload.
|
113
|
-
method_frame.channel.
|
112
|
+
expect(method_frame.payload).to eq("\x00\x14\x00(\x02\x1c\x0fNOT_IMPLEMENTED\x00\x00\x00\x00")
|
113
|
+
expect(method_frame.channel).to eq(1)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -119,9 +119,9 @@ module AMQ
|
|
119
119
|
describe '.encode' do
|
120
120
|
it 'encodes the parameters into a MethodFrame' do
|
121
121
|
channel = 1
|
122
|
-
method_frame = CloseOk.encode(
|
123
|
-
method_frame.payload.
|
124
|
-
method_frame.channel.
|
122
|
+
method_frame = CloseOk.encode(channel)
|
123
|
+
expect(method_frame.payload).to eq("\x00\x14\x00\x29")
|
124
|
+
expect(method_frame.channel).to eq(channel)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|