aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-07-13 10:43:52 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-07-13 11:30:52 -0500
commite1da6814b44110bc640a297bbca98bd87950b192 (patch)
tree5f45c33d0f0a47d07ea9f3d1a621d30ba026a9df
parented7658f1f3ac9d2a91e61187645cf7531a0a0db4 (diff)
downloadrails-e1da6814b44110bc640a297bbca98bd87950b192.tar.gz
rails-e1da6814b44110bc640a297bbca98bd87950b192.tar.bz2
rails-e1da6814b44110bc640a297bbca98bd87950b192.zip
Always load all the stub files
-rw-r--r--test/channel/base_test.rb3
-rw-r--r--test/channel/periodic_timers_test.rb3
-rw-r--r--test/channel/stream_test.rb3
-rw-r--r--test/stubs/room.rb12
-rw-r--r--test/test_helper.rb3
5 files changed, 18 insertions, 6 deletions
diff --git a/test/channel/base_test.rb b/test/channel/base_test.rb
index e525631642..aa31d23297 100644
--- a/test/channel/base_test.rb
+++ b/test/channel/base_test.rb
@@ -1,9 +1,8 @@
require 'test_helper'
require 'stubs/test_connection'
+require 'stubs/room'
class ActionCable::Channel::BaseTest < ActiveSupport::TestCase
- Room = Struct.new(:id)
-
class ChatChannel < ActionCable::Channel::Base
attr_reader :room, :last_action
on_subscribe :toggle_subscribed
diff --git a/test/channel/periodic_timers_test.rb b/test/channel/periodic_timers_test.rb
index 96d3e01783..1590a12f09 100644
--- a/test/channel/periodic_timers_test.rb
+++ b/test/channel/periodic_timers_test.rb
@@ -1,9 +1,8 @@
require 'test_helper'
require 'stubs/test_connection'
+require 'stubs/room'
class ActionCable::Channel::PeriodicTimersTest < ActiveSupport::TestCase
- Room = Struct.new(:id)
-
class ChatChannel < ActionCable::Channel::Base
periodically -> { ping }, every: 5
periodically :send_updates, every: 1
diff --git a/test/channel/stream_test.rb b/test/channel/stream_test.rb
index 2f4c988adf..1a8c259d11 100644
--- a/test/channel/stream_test.rb
+++ b/test/channel/stream_test.rb
@@ -1,9 +1,8 @@
require 'test_helper'
require 'stubs/test_connection'
+require 'stubs/room'
class ActionCable::Channel::StreamTest < ActiveSupport::TestCase
- Room = Struct.new(:id)
-
class ChatChannel < ActionCable::Channel::Base
def subscribed
@room = Room.new params[:id]
diff --git a/test/stubs/room.rb b/test/stubs/room.rb
new file mode 100644
index 0000000000..388b5ae33f
--- /dev/null
+++ b/test/stubs/room.rb
@@ -0,0 +1,12 @@
+class Room
+ attr_reader :id, :name
+
+ def initialize(id, name='Campfire')
+ @id = id
+ @name = name
+ end
+
+ def to_global_id
+ "Room##{id}-#{name}"
+ end
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 5b8ba110db..0e0191e804 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -13,6 +13,9 @@ 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