Sha256: c94d5afda17088ce551d380b78580f516c3f617d8435c621fef13f8f4d08e5da
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'bacon' require File.dirname(__FILE__) + '/../lib/pusher-client.rb' 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', {'socket_id' => '123abc'}) end @connection_thread.run @connection_thread.join unless async sleep(1) 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 end PusherClient.logger = TestLogger.new('test.log') end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pusher-client-0.1.1 | test/teststrap.rb |