Sha256: df79152d4aa3171d718cb48418a7e7ad2f5371aba1db634d45513a5b395f388f

Contents?: true

Size: 592 Bytes

Versions: 27

Compression:

Stored size: 592 Bytes

Contents

require 'spec_helper'

module WebsocketRails
  
  class MockWebSocket
    attr_writer :onmessage, :onerror, :onclose

    def env
      env = Rack::MockRequest.env_for('/websocket')
    end
    
    def onmessage(event=nil)
      @onmessage.call(event)
    end
    
    def onerror(event=nil)
      @onerror.call(event)
    end
    
    def onclose(event=nil)
      @onclose.call(event)
    end
    
    def rack_response
      [ -1, {}, [] ]
    end
    
    def send(*args)
      true
    end

    def trigger(event)
      true
    end

    def id
      object_id.to_i
    end
  end
  
end

Version data entries

27 entries across 27 versions & 3 rubygems

Version Path
hkroger-websocket-rails-0.7.1 spec/support/mock_web_socket.rb
wwl-websocket-rails-0.7.3 spec/support/mock_web_socket.rb
wwl-websocket-rails-0.7.2 spec/support/mock_web_socket.rb
wwl-websocket-rails-0.7.1 spec/support/mock_web_socket.rb
websocket-rails-0.7.0 spec/support/mock_web_socket.rb
websocket-rails-0.6.2 spec/support/mock_web_socket.rb
websocket-rails-0.6.1 spec/support/mock_web_socket.rb
websocket-rails-0.6.0 spec/support/mock_web_socket.rb
websocket-rails-0.5.0 spec/support/mock_web_socket.rb
websocket-rails-0.4.9 spec/support/mock_web_socket.rb
websocket-rails-0.4.8 spec/support/mock_web_socket.rb
websocket-rails-0.4.7 spec/support/mock_web_socket.rb
websocket-rails-0.4.6 spec/support/mock_web_socket.rb
websocket-rails-0.4.5 spec/support/mock_web_socket.rb
websocket-rails-0.4.4 spec/support/mock_web_socket.rb
websocket-rails-0.4.3 spec/support/mock_web_socket.rb
websocket-rails-0.4.2 spec/support/mock_web_socket.rb
websocket-rails-0.4.1 spec/support/mock_web_socket.rb
websocket-rails-0.4.0 spec/support/mock_web_socket.rb
websocket-rails-0.3.0 spec/support/mock_web_socket.rb