aboutsummaryrefslogtreecommitdiffstats
path: root/test/stubs/test_connection.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-07-12 10:07:31 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-07-12 11:44:56 -0500
commit1af531dcf7b8d9ee4237ea5fd392b43875309954 (patch)
tree4eba7ddbaad86b7453cec0bab3117e9bcf0231d2 /test/stubs/test_connection.rb
parent53c82f6dc036fab537b67b011ae604af646a58a3 (diff)
downloadrails-1af531dcf7b8d9ee4237ea5fd392b43875309954.tar.gz
rails-1af531dcf7b8d9ee4237ea5fd392b43875309954.tar.bz2
rails-1af531dcf7b8d9ee4237ea5fd392b43875309954.zip
Add some more tests
Diffstat (limited to 'test/stubs/test_connection.rb')
-rw-r--r--test/stubs/test_connection.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/stubs/test_connection.rb b/test/stubs/test_connection.rb
new file mode 100644
index 0000000000..1c353f9ee3
--- /dev/null
+++ b/test/stubs/test_connection.rb
@@ -0,0 +1,26 @@
+require 'stubs/user'
+
+class TestConnection
+ attr_reader :identifiers, :logger, :current_user, :transmissions
+
+ def initialize(user = User.new("lifo"))
+ @identifiers = [ :current_user ]
+
+ @current_user = user
+ @logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new)
+ @transmissions = []
+ end
+
+ def transmit(data)
+ @transmissions << data
+ end
+
+ def last_transmission
+ @transmissions.last
+ end
+
+ # Disable async in tests
+ def send_async(method, *arguments)
+ send method, *arguments
+ end
+end