File: confirm_spec.rb

package info (click to toggle)
ruby-amq-protocol 2.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 572 kB
  • sloc: ruby: 5,975; python: 248; makefile: 4
file content (41 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# encoding: binary

module AMQ
  module Protocol
    class Confirm
      RSpec.describe Select do
        describe '.decode' do
          subject do
            Select.decode("\x01")
          end

          its(:nowait) { should be_truthy }
        end

        describe '.encode' do
          it 'encodes the parameters into a MethodFrame' do
            channel = 1
            nowait = true
            method_frame = Select.encode(channel, nowait)
            expect(method_frame.payload).to eq("\x00U\x00\n\x01")
            expect(method_frame.channel).to eq(1)
          end
        end
      end

      RSpec.describe SelectOk do
        # describe '.decode' do
        # end

        describe '.encode' do
          it 'encodes the parameters into a MethodFrame' do
            channel = 1
            method_frame = SelectOk.encode(channel)
            expect(method_frame.payload).to eq("\000U\000\v")
            expect(method_frame.channel).to eq(1)
          end
        end
      end
    end
  end
end