File: outgoing_frames.rb

package info (click to toggle)
ruby-websocket 1.2.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 464 kB
  • sloc: ruby: 2,669; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (2)
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
# frozen_string_literal: true

RSpec.shared_examples_for 'valid_outgoing_frame' do
  it 'is outgoing frame' do
    expect(subject.class).to be WebSocket::Frame::Outgoing
  end

  it 'is in proper verions' do
    expect(subject.version).to eql version
  end

  it 'has proper type set' do
    expect(subject.type).to eql frame_type
  end

  it 'contains decoded data' do
    expect(subject.data).to eql(decoded_text)
  end

  it 'returns encoded data as to_s' do
    expect(subject.to_s).to eql(encoded_text)
  end

  context 'after parsing' do
    before { subject.to_s }

    it 'has valid errors set' do
      expect(subject.error).to eql error
    end

    it 'requires sending' do
      expect(subject.require_sending?).to eql require_sending
    end
  end
end