Sha256: e5f300fa83d4c93498a0f55132475a8648c25dce471e3203f223e00346670ad9

Contents?: true

Size: 1.01 KB

Versions: 16

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'
require 'startback/websocket'

module Startback
  module Websocket
    describe App do
      include Rack::Test::Methods

      def app
        App.new(SpecHelpers::SubContext.new)
      end

      it 'returns a 400 when not used with proper websocket handshake' do
        get '/'
        expect(last_response.status).to eql(400)
        expect(last_response.body).to eql('Websocket only!')
      end

      it 'does respond with proper handshake in the context of websocket connections' do
        header 'connection', 'upgrade'
        header 'upgrade', 'websocket'
        get '/'
        # https://github.com/faye/faye-websocket-ruby/blob/main/lib/faye/websocket.rb#L93
        expect(last_response.status).to eql(-1)
      end

      it 'serves the javascript client properly' do
        get '/client.js'
        expect(last_response.status).to eql(200)
        expect(last_response['Content-Type']).to eql('application/javascript')
      end

    end # describe
  end # module Web
end # module Startback

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
startback-websocket-0.17.4 spec/unit/test_app.rb
startback-websocket-0.17.3 spec/unit/test_app.rb
startback-websocket-0.17.2 spec/unit/test_app.rb
startback-websocket-0.17.1 spec/unit/test_app.rb
startback-websocket-0.17.0 spec/unit/test_app.rb
startback-websocket-0.16.0 spec/unit/test_app.rb
startback-websocket-0.15.5 spec/unit/test_app.rb
startback-websocket-0.15.4 spec/unit/test_app.rb
startback-websocket-0.15.3 spec/unit/test_app.rb
startback-websocket-0.15.2 spec/unit/test_app.rb
startback-websocket-0.15.1 spec/unit/test_app.rb
startback-websocket-0.15.0 spec/unit/test_app.rb
startback-websocket-0.14.4 spec/unit/test_app.rb
startback-websocket-0.14.3 spec/unit/test_app.rb
startback-websocket-0.14.2 spec/unit/test_app.rb
startback-websocket-0.14.1 spec/unit/test_app.rb