diff options
-rw-r--r-- | Rakefile | 1 | ||||
-rw-r--r-- | lib/action_cable/connection/identification.rb | 2 | ||||
-rw-r--r-- | lib/action_cable/server/connections.rb | 2 | ||||
-rw-r--r-- | test/channel/base_test.rb | 5 | ||||
-rw-r--r-- | test/test_helper.rb | 8 |
5 files changed, 14 insertions, 4 deletions
@@ -7,5 +7,6 @@ Rake::TestTask.new(:test) do |t| t.libs << "test" t.pattern = 'test/**/*_test.rb' t.verbose = true + t.warning = false end Rake::Task['test'].comment = "Run tests" diff --git a/lib/action_cable/connection/identification.rb b/lib/action_cable/connection/identification.rb index 4e9beac058..95863795dd 100644 --- a/lib/action_cable/connection/identification.rb +++ b/lib/action_cable/connection/identification.rb @@ -22,7 +22,7 @@ module ActionCable # Return a single connection identifier that combines the value of all the registered identifiers into a single gid. def connection_identifier - if @connection_identifier.blank? + unless defined? @connection_identifier @connection_identifier = connection_gid identifiers.map { |id| instance_variable_get("@#{id}") }.compact end diff --git a/lib/action_cable/server/connections.rb b/lib/action_cable/server/connections.rb index 153cebd710..47dcea8c20 100644 --- a/lib/action_cable/server/connections.rb +++ b/lib/action_cable/server/connections.rb @@ -24,7 +24,7 @@ module ActionCable def setup_heartbeat_timer EM.next_tick do @heartbeat_timer ||= EventMachine.add_periodic_timer(BEAT_INTERVAL) do - EM.next_tick { connections.map &:beat } + EM.next_tick { connections.map(&:beat) } end end end diff --git a/test/channel/base_test.rb b/test/channel/base_test.rb index e7944ff06b..bac8569780 100644 --- a/test/channel/base_test.rb +++ b/test/channel/base_test.rb @@ -23,6 +23,11 @@ class ActionCable::Channel::BaseTest < ActiveSupport::TestCase on_subscribe :toggle_subscribed on_unsubscribe :toggle_subscribed + def initialize(*) + @subscribed = false + super + end + def subscribed @room = Room.new params[:id] @actions = [] diff --git a/test/test_helper.rb b/test/test_helper.rb index 49fb1495f4..b9cb34f891 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -18,12 +18,16 @@ ActiveSupport.test_order = :sorted # Require all the stubs and models Dir[File.dirname(__FILE__) + '/stubs/*.rb'].each {|file| require file } +$CELLULOID_DEBUG = false +$CELLULOID_TEST = false Celluloid.logger = Logger.new(StringIO.new) -class Faye::WebSocket +class << Faye::WebSocket + remove_method :ensure_reactor_running + # We don't want Faye to start the EM reactor in tests because it makes testing much harder. # We want to be able to start and stop EM loop in tests to make things simpler. - def self.ensure_reactor_running + def ensure_reactor_running # no-op end end |