class ActionController::SSETest
Public Instance Methods
test_basic_sse()
click to toggle source
# File actionpack/test/controller/live_stream_test.rb, line 60 def test_basic_sse get :basic_sse wait_for_response_stream_close assert_match(/data: {\"name\":\"John\"}/, response.body) assert_match(/data: {\"name\":\"Ryan\"}/, response.body) end
test_sse_with_event_name()
click to toggle source
# File actionpack/test/controller/live_stream_test.rb, line 68 def test_sse_with_event_name get :sse_with_event wait_for_response_stream_close assert_match(/data: {\"name\":\"John\"}/, response.body) assert_match(/data: {\"name\":\"Ryan\"}/, response.body) assert_match(/event: send-name/, response.body) end
test_sse_with_id()
click to toggle source
# File actionpack/test/controller/live_stream_test.rb, line 89 def test_sse_with_id get :sse_with_id wait_for_response_stream_close first_response, second_response = response.body.split("\n\n") assert_match(/data: {\"name\":\"John\"}/, first_response) assert_match(/id: 1/, first_response) assert_match(/data: {\"name\":\"Ryan\"}/, second_response) assert_match(/id: 2/, second_response) end
test_sse_with_multiple_line_message()
click to toggle source
# File actionpack/test/controller/live_stream_test.rb, line 101 def test_sse_with_multiple_line_message get :sse_with_multiple_line_message wait_for_response_stream_close first_response, second_response = response.body.split("\n") assert_match(/data: first line/, first_response) assert_match(/data: second line/, second_response) end
test_sse_with_retry()
click to toggle source
# File actionpack/test/controller/live_stream_test.rb, line 77 def test_sse_with_retry get :sse_with_retry wait_for_response_stream_close first_response, second_response = response.body.split("\n\n") assert_match(/data: {\"name\":\"John\"}/, first_response) assert_match(/retry: 1000/, first_response) assert_match(/data: {\"name\":\"Ryan\"}/, second_response) assert_match(/retry: 1500/, second_response) end
wait_for_response_stream_close()
click to toggle source
# File actionpack/test/controller/live_stream_test.rb, line 56 def wait_for_response_stream_close response.body end