blob: 0e0191e804384db42eed36e4a6827956f9ad1ed2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
require "rubygems"
require "bundler"
gem 'minitest'
require "minitest/autorun"
Bundler.setup
Bundler.require :default, :test
require 'puma'
require 'mocha/mini_test'
require 'action_cable'
ActiveSupport.test_order = :sorted
# Require all the stubs and models
Dir[File.dirname(__FILE__) + '/stubs/*.rb'].each {|file| require file }
class ActionCableTest < ActiveSupport::TestCase
PORT = 420420
setup :start_puma_server
teardown :stop_puma_server
def start_puma_server
events = Puma::Events.new(StringIO.new, StringIO.new)
binder = Puma::Binder.new(events)
binder.parse(["tcp://0.0.0.0:#{PORT}"], self)
@server = Puma::Server.new(app, events)
@server.binder = binder
@server.run
end
def stop_puma_server
@server.stop(true)
end
def websocket_url
"ws://0.0.0.0:#{PORT}/"
end
def log(*args)
end
end
|