File: masking_spec.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 (18 lines) | stat: -rw-r--r-- 693 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# encoding: binary
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Masking frame draft 07' do
  it 'encodes and decode masked frame correctly' do
    outgoing_frame = WebSocket::Frame::Outgoing::Client.new(data: 'Hello World', type: 'text')
    outgoing_frame.to_s
    expect(outgoing_frame.error).to be_nil
    incoming_frame = WebSocket::Frame::Incoming::Server.new(data: outgoing_frame.to_s).next
    expect(incoming_frame).not_to be_nil
    expect(incoming_frame.class).to eql(WebSocket::Frame::Incoming::Server)
    expect(incoming_frame.error).to be_nil
    expect(incoming_frame.decoded?).to be true
    expect(incoming_frame.to_s).to eql('Hello World')
  end
end