Sha256: d97681e94054cea5c9e6b92d0baa3b48c2090c395a7a8bffab7575aef667b4b6

Contents?: true

Size: 854 Bytes

Versions: 2

Compression:

Stored size: 854 Bytes

Contents

require 'spec_helper'

describe 'Client draft 76 handshake' do
  let(:handshake) { WebSocket::Handshake::Client.new({ :uri => 'ws://example.com/demo', :origin => 'http://example.com', :version => version }.merge(@request_params || {})) }

  let(:version) { 76 }
  let(:client_request) { client_handshake_76({ :key1 => handshake.key1, :key2 => handshake.key2, :key3 => handshake.key3 }.merge(@request_params || {})) }
  let(:server_response) { server_handshake_76({ :challenge => handshake.send(:challenge) }.merge(@request_params || {})) }

  it_should_behave_like 'all client drafts'

  it "should disallow client with invalid challenge" do
    @request_params = { :challenge => "invalid" }
    handshake << server_response

    handshake.should be_finished
    handshake.should_not be_valid
    handshake.error.should eql(:invalid_challenge)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
websocket-1.0.1 spec/handshake/client_76_spec.rb
websocket-1.0.0 spec/handshake/client_76_spec.rb