diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-08 23:21:18 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-08 23:21:18 +0000 |
commit | 9abb447a573751b87e26ce35f4f05d58290f4c41 (patch) | |
tree | 1adb0dac9acd99c9add0880751c7e022003776ef /t/cramp | |
parent | 235985c6c4b37ed9a170c38052db3ef0772b1527 (diff) | |
download | rainbows-9abb447a573751b87e26ce35f4f05d58290f4c41.tar.gz |
Cramp monkey patches Rainbows internals for WebSockets support and we forgot about it. Add a new integration test to ensure this continues to work in the future (and force us to update the test for newer Cramp).
Diffstat (limited to 't/cramp')
-rw-r--r-- | t/cramp/rainsocket.ru | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/cramp/rainsocket.ru b/t/cramp/rainsocket.ru new file mode 100644 index 0000000..0d26f70 --- /dev/null +++ b/t/cramp/rainsocket.ru @@ -0,0 +1,26 @@ +# based on examples/rainsocket.ru git://github.com/lifo/cramp +# Rack::Lint does not like async + EM stuff, so disable it: +#\ -E deployment +require 'cramp/controller' + +Cramp::Controller::Websocket.backend = :rainbows + +class WelcomeController < Cramp::Controller::Websocket + periodic_timer :send_hello_world, :every => 2 + on_data :received_data + + def received_data(data) + if data =~ /fuck/ + render "You cant say fuck in here" + finish + else + render "Got your #{data}" + end + end + + def send_hello_world + render "Hello from the Server!\n" + end +end + +run WelcomeController |