Sha256: 1c9acf9b7b12b166b3ece30af301c38679d7c3e0026830caccf5c16fdb229a6d
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
$:.unshift File.expand_path('../lib', __FILE__) require 'pusher-client' require 'logger' TEST_APP_KEY = "TEST_APP_KEY" module PusherClient class TestLogger < Logger attr_reader :test_messages def initialize(logdev, shift_age = 0, shift_size = 1048576) @test_messages = [] super end def test(msg) @test_messages << msg debug msg end end class Socket # Simulate a connection being established def connect(async = false) @connection_thread = Thread.new do @connection = TestConnection.new @global_channel.dispatch('pusher:connection_established', JSON.dump({'socket_id' => '123abc'})) end @connection_thread.run @connection_thread.join unless async return self end def simulate_received(event_name, event_data, channel_name) send_local_event(event_name, event_data, channel_name) end end class TestConnection def send(payload) PusherClient.logger.test("SEND: #{payload}") end def close end end PusherClient.logger = TestLogger.new('test.log') end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pusher-client-0.6.2 | spec/spec_helper.rb |
pusher-client-0.6.1 | spec/spec_helper.rb |
pusher-client-0.6.0 | spec/spec_helper.rb |
pusher-client-0.5.0 | spec/spec_helper.rb |