Sha256: 1ff70dfeb8f63c88a6dc6ba40a59c57e7f5f5a120a70445ecfa4993f06eff7d8

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

# encoding: binary
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Outgoing frame draft 75' do
  subject { frame }

  let(:version) { 75 }
  let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) }
  let(:decoded_text) { '' }
  let(:encoded_text) { "\x00\xFF" }
  let(:frame_type) { :text }
  let(:require_sending) { true }
  let(:error) { nil }

  it_behaves_like 'valid_outgoing_frame'

  context 'should properly encode text frame' do
    let(:decoded_text) { 'abc' }
    let(:encoded_text) { "\x00abc\xFF" }
    let(:require_sending) { true }

    it_behaves_like 'valid_outgoing_frame'
  end

  context 'should properly encode close frame' do
    let(:frame_type) { :close }
    let(:decoded_text) { 'abc' }
    let(:encoded_text) { "\xFF\x00" }
    let(:require_sending) { true }

    it_behaves_like 'valid_outgoing_frame'
  end

  context 'should return error for unknown frame type' do
    let(:frame_type) { :unknown }
    let(:decoded_text) { 'Hello' }
    let(:encoded_text) { nil }
    let(:error) { :unknown_frame_type }
    let(:require_sending) { false }

    it_behaves_like 'valid_outgoing_frame'
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/websocket-1.2.10/spec/frame/outgoing_75_spec.rb
websocket-1.2.11 spec/frame/outgoing_75_spec.rb
websocket-1.2.10 spec/frame/outgoing_75_spec.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/websocket-1.2.9/spec/frame/outgoing_75_spec.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/websocket-1.2.9/spec/frame/outgoing_75_spec.rb
websocket-1.2.9 spec/frame/outgoing_75_spec.rb
websocket-1.2.8 spec/frame/outgoing_75_spec.rb
websocket-1.2.7 spec/frame/outgoing_75_spec.rb