amq-protocol 2.2.0 → 2.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,4 @@
1
- # encoding: binary
2
-
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
-
6
- describe AMQ::Protocol::Method, ".encode_body" do
1
+ RSpec.describe AMQ::Protocol::Method, ".encode_body" do
7
2
  it "encodes 1-byte long payload as exactly 1 body frame" do
8
3
  expect(described_class.encode_body('1', 1, 65536).size).to eq(1)
9
4
  end
@@ -1,12 +1,9 @@
1
1
  # encoding: binary
2
2
 
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
-
6
3
  module AMQ
7
4
  module Protocol
8
5
  class Channel
9
- describe Open do
6
+ RSpec.describe Open do
10
7
  describe '.encode' do
11
8
  it 'encodes the parameters into a MethodFrame' do
12
9
  channel = 1
@@ -18,7 +15,7 @@ module AMQ
18
15
  end
19
16
  end
20
17
 
21
- describe OpenOk do
18
+ RSpec.describe OpenOk do
22
19
  describe '.decode' do
23
20
  subject do
24
21
  OpenOk.decode("\x00\x00\x00\x03foo")
@@ -28,7 +25,7 @@ module AMQ
28
25
  end
29
26
  end
30
27
 
31
- describe Flow do
28
+ RSpec.describe Flow do
32
29
  describe '.decode' do
33
30
  subject do
34
31
  Flow.decode("\x01")
@@ -48,7 +45,7 @@ module AMQ
48
45
  end
49
46
  end
50
47
 
51
- describe FlowOk do
48
+ RSpec.describe FlowOk do
52
49
  describe '.decode' do
53
50
  subject do
54
51
  FlowOk.decode("\x00")
@@ -68,7 +65,7 @@ module AMQ
68
65
  end
69
66
  end
70
67
 
71
- describe Close do
68
+ RSpec.describe Close do
72
69
  describe '.decode' do
73
70
  context 'with code 200' do
74
71
  subject do
@@ -115,7 +112,7 @@ module AMQ
115
112
  end
116
113
  end
117
114
 
118
- describe CloseOk do
115
+ RSpec.describe CloseOk do
119
116
  describe '.encode' do
120
117
  it 'encodes the parameters into a MethodFrame' do
121
118
  channel = 1
@@ -1,20 +1,17 @@
1
1
  # encoding: binary
2
2
 
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
-
6
3
  module AMQ
7
4
  module Protocol
8
5
  class Confirm
9
- describe Select do
6
+ RSpec.describe Select do
10
7
  describe '.decode' do
11
8
  subject do
12
9
  Select.decode("\x01")
13
10
  end
14
-
11
+
15
12
  its(:nowait) { should be_truthy }
16
13
  end
17
-
14
+
18
15
  describe '.encode' do
19
16
  it 'encodes the parameters into a MethodFrame' do
20
17
  channel = 1
@@ -25,11 +22,11 @@ module AMQ
25
22
  end
26
23
  end
27
24
  end
28
-
29
- describe SelectOk do
25
+
26
+ RSpec.describe SelectOk do
30
27
  # describe '.decode' do
31
28
  # end
32
-
29
+
33
30
  describe '.encode' do
34
31
  it 'encodes the parameters into a MethodFrame' do
35
32
  channel = 1
@@ -1,12 +1,9 @@
1
1
  # encoding: binary
2
2
 
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
-
6
3
  module AMQ
7
4
  module Protocol
8
5
  class Connection
9
- describe Start do
6
+ RSpec.describe Start do
10
7
  describe '.decode' do
11
8
  subject do
12
9
  Start.decode("\x00\t\x00\x00\x00\xFB\tcopyrightS\x00\x00\x00gCopyright (C) 2007-2010 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.\vinformationS\x00\x00\x005Licensed under the MPL. See http://www.rabbitmq.com/\bplatformS\x00\x00\x00\nErlang/OTP\aproductS\x00\x00\x00\bRabbitMQ\aversionS\x00\x00\x00\x052.2.0\x00\x00\x00\x0EPLAIN AMQPLAIN\x00\x00\x00\x05en_US")
@@ -20,7 +17,7 @@ module AMQ
20
17
  end
21
18
  end
22
19
 
23
- describe StartOk do
20
+ RSpec.describe StartOk do
24
21
  describe '.encode' do
25
22
  it 'encodes the parameters into a MethodFrame' do
26
23
  client_properties = {:platform => 'Ruby 1.9.2', :product => 'AMQ Client', :information => 'http://github.com/ruby-amqp/amq-client', :version => '0.2.0'}
@@ -39,18 +36,18 @@ module AMQ
39
36
  end
40
37
  end
41
38
  end
42
-
43
- describe Secure do
39
+
40
+ RSpec.describe Secure do
44
41
  describe '.decode' do
45
42
  subject do
46
43
  Secure.decode("\x00\x00\x00\x03foo")
47
44
  end
48
-
45
+
49
46
  its(:challenge) { should eq('foo') }
50
47
  end
51
48
  end
52
-
53
- describe SecureOk do
49
+
50
+ RSpec.describe SecureOk do
54
51
  describe '.encode' do
55
52
  it 'encodes the parameters as a MethodFrame' do
56
53
  response = 'bar'
@@ -59,8 +56,8 @@ module AMQ
59
56
  end
60
57
  end
61
58
  end
62
-
63
- describe Tune do
59
+
60
+ RSpec.describe Tune do
64
61
  describe '.decode' do
65
62
  subject do
66
63
  Tune.decode("\x00\x00\x00\x02\x00\x00\x00\x00")
@@ -72,7 +69,7 @@ module AMQ
72
69
  end
73
70
  end
74
71
 
75
- describe TuneOk do
72
+ RSpec.describe TuneOk do
76
73
  describe '.encode' do
77
74
  it 'encodes the parameters into a MethodFrame' do
78
75
  channel_max = 0
@@ -83,8 +80,8 @@ module AMQ
83
80
  end
84
81
  end
85
82
  end
86
-
87
- describe Open do
83
+
84
+ RSpec.describe Open do
88
85
  describe '.encode' do
89
86
  it 'encodes the parameters into a MethodFrame' do
90
87
  vhost = '/test'
@@ -93,37 +90,37 @@ module AMQ
93
90
  end
94
91
  end
95
92
  end
96
-
97
- describe OpenOk do
93
+
94
+ RSpec.describe OpenOk do
98
95
  describe '.decode' do
99
96
  subject do
100
97
  OpenOk.decode("\x00")
101
98
  end
102
-
99
+
103
100
  its(:known_hosts) { should eq('') }
104
101
  end
105
102
  end
106
-
107
- describe Close do
103
+
104
+ RSpec.describe Close do
108
105
  describe '.decode' do
109
106
  context 'with code 200' do
110
107
  subject do
111
108
  Close.decode("\x00\xc8\x07KTHXBAI\x00\x05\x00\x06")
112
109
  end
113
-
110
+
114
111
  its(:reply_code) { should eq(200) }
115
112
  its(:reply_text) { should eq('KTHXBAI') }
116
113
  its(:class_id) { should eq(5) }
117
114
  its(:method_id) { should eq(6) }
118
115
  end
119
-
116
+
120
117
  context 'with an error code' do
121
118
  it 'returns method frame and lets calling code handle the issue' do
122
119
  Close.decode("\x01\x38\x08NO_ROUTE\x00\x00")
123
120
  end
124
121
  end
125
122
  end
126
-
123
+
127
124
  describe '.encode' do
128
125
  it 'encodes the parameters into a MethodFrame' do
129
126
  reply_code = 540
@@ -135,8 +132,8 @@ module AMQ
135
132
  end
136
133
  end
137
134
  end
138
-
139
- describe CloseOk do
135
+
136
+ RSpec.describe CloseOk do
140
137
  describe '.encode' do
141
138
  it 'encodes a MethodFrame' do
142
139
  method_frame = CloseOk.encode
@@ -1,8 +1,4 @@
1
- # encoding: binary
2
-
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
- describe "(Some) AMQ::Protocol constants" do
1
+ RSpec.describe "(Some) AMQ::Protocol constants" do
6
2
  it "include regular port" do
7
3
  expect(AMQ::Protocol::DEFAULT_PORT).to eq(5672)
8
4
  end
@@ -1,12 +1,9 @@
1
1
  # encoding: binary
2
2
 
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
-
6
3
  module AMQ
7
4
  module Protocol
8
5
  class Exchange
9
- describe Declare do
6
+ RSpec.describe Declare do
10
7
  describe '.encode' do
11
8
  it 'encodes the parameters into a MethodFrame' do
12
9
  channel = 1
@@ -25,7 +22,7 @@ module AMQ
25
22
  end
26
23
  end
27
24
 
28
- describe Declare, "encoded with a symbol name" do
25
+ RSpec.describe Declare, "encoded with a symbol name" do
29
26
  describe '.encode' do
30
27
  it 'encodes the parameters into a MethodFrame' do
31
28
  channel = 1
@@ -44,7 +41,7 @@ module AMQ
44
41
  end
45
42
  end
46
43
 
47
- describe Delete do
44
+ RSpec.describe Delete do
48
45
  describe '.encode' do
49
46
  it 'encodes the parameters into a MethodFrame' do
50
47
  channel = 1
@@ -58,12 +55,12 @@ module AMQ
58
55
  end
59
56
  end
60
57
 
61
- # describe DeleteOk do
58
+ # RSpec.describe DeleteOk do
62
59
  # describe '.decode' do
63
60
  # end
64
61
  # end
65
62
 
66
- describe Bind do
63
+ RSpec.describe Bind do
67
64
  describe '.encode' do
68
65
  it 'encodes the parameters into a MethodFrame' do
69
66
  channel = 1
@@ -79,12 +76,12 @@ module AMQ
79
76
  end
80
77
  end
81
78
 
82
- # describe BindOk do
79
+ # RSpec.describe BindOk do
83
80
  # describe '.decode' do
84
81
  # end
85
82
  # end
86
83
 
87
- describe Unbind do
84
+ RSpec.describe Unbind do
88
85
  describe '.encode' do
89
86
  it 'encodes the parameters into a MethodFrame' do
90
87
  channel = 1
@@ -100,7 +97,7 @@ module AMQ
100
97
  end
101
98
  end
102
99
 
103
- # describe UnbindOk do
100
+ # RSpec.describe UnbindOk do
104
101
  # describe '.decode' do
105
102
  # end
106
103
  # end
@@ -1,11 +1,6 @@
1
- # encoding: utf-8
2
-
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
-
6
1
  module AMQ
7
2
  module Protocol
8
- describe Frame do
3
+ RSpec.describe Frame do
9
4
  describe ".encode" do
10
5
  it "should raise FrameTypeError if type isn't one of: [:method, :header, :body, :heartbeat]" do
11
6
  expect { Frame.encode(nil, "", 0) }.to raise_error(FrameTypeError)
@@ -1,11 +1,6 @@
1
- # encoding: binary
2
-
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
-
6
1
  module AMQ
7
2
  module Protocol
8
- describe Method do
3
+ RSpec.describe Method do
9
4
  describe '.split_headers' do
10
5
  it 'splits user defined headers into properties and headers' do
11
6
  input = {:delivery_mode => 2, :content_type => 'application/octet-stream', :foo => 'bar'}
@@ -14,7 +9,7 @@ module AMQ
14
9
  expect(headers).to eq({:foo => 'bar'})
15
10
  end
16
11
  end
17
-
12
+
18
13
  describe '.encode_body' do
19
14
  context 'when the body fits in a single frame' do
20
15
  it 'encodes a body into a BodyFrame' do
@@ -1,12 +1,9 @@
1
1
  # encoding: binary
2
2
 
3
- require File.expand_path('../../../spec_helper', __FILE__)
4
-
5
-
6
3
  module AMQ
7
4
  module Protocol
8
5
  class Queue
9
- describe Declare do
6
+ RSpec.describe Declare do
10
7
  describe '.encode' do
11
8
  it 'encodes the parameters into a MethodFrame' do
12
9
  channel = 1
@@ -24,19 +21,19 @@ module AMQ
24
21
  end
25
22
  end
26
23
 
27
- describe DeclareOk do
24
+ RSpec.describe DeclareOk do
28
25
  describe '.decode' do
29
26
  subject do
30
27
  DeclareOk.decode(" amq.gen-KduGSqQrpeUo1otnU0TWSA==\x00\x00\x00\x00\x00\x00\x00\x00")
31
28
  end
32
-
29
+
33
30
  its(:queue) { should eq('amq.gen-KduGSqQrpeUo1otnU0TWSA==') }
34
31
  its(:message_count) { should eq(0) }
35
32
  its(:consumer_count) { should eq(0) }
36
33
  end
37
34
  end
38
35
 
39
- describe Bind do
36
+ RSpec.describe Bind do
40
37
  describe '.encode' do
41
38
  it 'encodes the parameters into a MethodFrame' do
42
39
  channel = 1
@@ -52,12 +49,12 @@ module AMQ
52
49
  end
53
50
  end
54
51
 
55
- # describe BindOk do
52
+ # RSpec.describe BindOk do
56
53
  # describe '.decode' do
57
54
  # end
58
55
  # end
59
56
 
60
- describe Purge do
57
+ RSpec.describe Purge do
61
58
  describe '.encode' do
62
59
  it 'encodes the parameters into a MethodFrame' do
63
60
  channel = 1
@@ -70,17 +67,17 @@ module AMQ
70
67
  end
71
68
  end
72
69
 
73
- describe PurgeOk do
70
+ RSpec.describe PurgeOk do
74
71
  describe '.decode' do
75
72
  subject do
76
73
  PurgeOk.decode("\x00\x00\x00\x02")
77
74
  end
78
-
75
+
79
76
  its(:message_count) { should eq(2) }
80
77
  end
81
78
  end
82
79
 
83
- describe Delete do
80
+ RSpec.describe Delete do
84
81
  describe '.encode' do
85
82
  it 'encodes the parameters into a MethodFrame' do
86
83
  channel = 1
@@ -95,17 +92,17 @@ module AMQ
95
92
  end
96
93
  end
97
94
 
98
- describe DeleteOk do
95
+ RSpec.describe DeleteOk do
99
96
  describe '.decode' do
100
97
  subject do
101
98
  DeleteOk.decode("\x00\x00\x00\x02")
102
99
  end
103
-
100
+
104
101
  its(:message_count) { should eq(2) }
105
102
  end
106
103
  end
107
104
 
108
- describe Unbind do
105
+ RSpec.describe Unbind do
109
106
  describe '.encode' do
110
107
  it 'encodes the parameters into a MethodFrame' do
111
108
  channel = 1
@@ -120,7 +117,7 @@ module AMQ
120
117
  end
121
118
  end
122
119
 
123
- # describe UnbindOk do
120
+ # RSpec.describe UnbindOk do
124
121
  # describe '.decode' do
125
122
  # end
126
123
  # end