Sha256: c67b6339d39559d2f2aa83841ed25c49b28e71c7cc9a0b59ae3e6fcdfdbfe3da

Contents?: true

Size: 921 Bytes

Versions: 26

Compression:

Stored size: 921 Bytes

Contents

require 'json'

module WebsocketRails
  module HelperMethods
    def env
      @_env ||= begin
        env = Rack::MockRequest.env_for('/websocket')
        env['async.callback'] = Proc.new { |response| true }
        env
      end
    end

    def mock_request
      @_request ||= ActionDispatch::Request.new(env)
    end

    def encoded_message
      ['test_event',{:data => {:user_name => 'Joe User'}}].to_json
    end

    def subscribe_encoded_message
      ['websocket_rails.subscribe',:data => nil, :channel => :awesome_channel].to_json
    end

    def received_encoded_message(connection_id)
      [connection_id,'test_event',{:user_name => 'Joe User'}].to_json
    end

    MockEvent = Struct.new(:name,:namespace)
  end
end

module EM
  def self.next_tick(&block)
    block.call if block.respond_to?(:call)
  end
  class PeriodicTimer
    def initialize(interval)
      @interval = interval
    end
  end
end

Version data entries

26 entries across 26 versions & 3 rubygems

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