Sha256: d58bbcc41b58f70dfcd7635c91c492a7fd58e83d328a5fcdc6e1c47df8674aec
Contents?: true
Size: 1.07 KB
Versions: 7
Compression:
Stored size: 1.07 KB
Contents
require_relative '../spec_helper' describe Angelo::Responder::Eventsource do describe 'route builder' do define_app do eventsource '/msg' do |c| c.write sse_message 'hi' c.close end eventsource '/event' do |c| c.write sse_event :sse, 'bye' c.close end end it 'sends messages' do get_sse '/msg' do |msg| msg.must_equal "data: hi\n\n" end end it 'sends events' do get_sse '/event' do |msg| msg.must_equal "event: sse\ndata: bye\n\n" end end end end describe 'eventsource helper' do define_app do get '/msg' do eventsource do |c| c.write sse_message 'hi' c.close end end get '/event' do eventsource do |c| c.write sse_event :sse, 'bye' c.close end end end it 'sends messages' do get_sse '/msg' do |msg| msg.must_equal "data: hi\n\n" end end it 'sends events' do get_sse '/event' do |msg| msg.must_equal "event: sse\ndata: bye\n\n" end end end
Version data entries
7 entries across 7 versions & 1 rubygems