Sha256: e5a046acf27123fd64708609efc3882e81561cc3f1d43dab22d45f677e8e86cd

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

# encoding: binary
require 'spec_helper'

describe 'Outgoing frame draft 75' do
  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 }
  subject { frame }

  it_should_behave_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_should_behave_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_should_behave_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_should_behave_like 'valid_outgoing_frame'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
websocket-1.1.4 spec/frame/outgoing_75_spec.rb
websocket-1.1.3 spec/frame/outgoing_75_spec.rb
websocket-1.1.2 spec/frame/outgoing_75_spec.rb
websocket-1.1.1 spec/frame/outgoing_75_spec.rb
websocket-1.1.0 spec/frame/outgoing_75_spec.rb
websocket-1.0.7 spec/frame/outgoing_75_spec.rb