Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Long polling test

  • Loading branch information...
commit db5f4d15026783a5d8ea30015bf79563dea46775 1 parent 7d740ac
@lifo authored
Showing with 37 additions and 0 deletions.
  1. +37 −0 test/controller/long_polling_test.rb
View
37 test/controller/long_polling_test.rb
@@ -0,0 +1,37 @@
+require 'test_helper'
+
+class LongPollingTest < Cramp::TestCase
+
+ class PollController < Cramp::Action
+ self.transport = :long_polling
+
+ on_start :foot_long_pole
+ on_finish :poll_done
+
+ def foot_long_pole
+ render "Hello World"
+ end
+
+ cattr_accessor :logs
+ self.logs = []
+ def poll_done
+ self.logs << 'Poll done'
+ end
+ end
+
+ def app
+ PollController
+ end
+
+ def test_body
+ get_body '/' do |body|
+ assert_equal 'Hello World', body
+ stop
+ end
+ end
+
+ def test_render_finishes_response
+ get('/') { EM.next_tick { stop } }
+ assert_equal 'Poll done', PollController.logs[0]
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.