Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Long polling test
  • Loading branch information
lifo committed Feb 18, 2011
1 parent 7d740ac commit db5f4d1
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions 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

0 comments on commit db5f4d1

Please sign in to comment.