Sha256: 7af41e9b4b8fe6ff7f4856998d81f3eaa7c2d45073e23309b770e86ad1c97f81

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require 'helper'

describe "draft05" do
  include EM::SpecHelper
  default_timeout 1

  before :each do
    @request = {
      :port => 80,
      :method => "GET",
      :path => "/demo",
      :headers => {
        'Host' => 'example.com',
        'Upgrade' => 'websocket',
        'Connection' => 'Upgrade',
        'Sec-WebSocket-Key' => 'dGhlIHNhbXBsZSBub25jZQ==',
        'Sec-WebSocket-Protocol' => 'sample',
        'Sec-WebSocket-Origin' => 'http://example.com',
        'Sec-WebSocket-Version' => '5'
      }
    }
  end

  def start_client
    client = EM.connect('0.0.0.0', 12345, Draft05FakeWebSocketClient)
    client.send_data(format_request(@request))
    yield client if block_given?
    return client
  end
  
  it_behaves_like "a websocket server" do
    let(:version) { 5 }
  end

  it_behaves_like "a WebSocket server drafts 3 and above" do
    let(:version) { 5 }
  end

  it "should report that close codes are not supported" do
    em {
      start_server { |ws|
        ws.onopen {
          ws.supports_close_codes?.should == false
          done
        }
      }
      start_client
    }
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
em-websocket-0.5.3 spec/integration/draft05_spec.rb
em-websocket-0.5.2 spec/integration/draft05_spec.rb
sonixlabs-em-websocket-0.5.1.5 spec/integration/draft05_spec.rb
sonixlabs-em-websocket-0.5.1.4 spec/integration/draft05_spec.rb
sonixlabs-em-websocket-0.5.1.3 spec/integration/draft05_spec.rb
sonixlabs-em-websocket-0.5.1.2 spec/integration/draft05_spec.rb
sonixlabs-em-websocket-0.5.1.1 spec/integration/draft05_spec.rb
em-websocket-0.5.1 spec/integration/draft05_spec.rb