Sha256: d13bec08281523c0210c698766160d6ec4a23bc9d2371d1eec94f227bb3db7a9
Contents?: true
Size: 1.62 KB
Versions: 4
Compression:
Stored size: 1.62 KB
Contents
require_relative '../spec_helper' module RUPNP module SSDP describe Notifier do include EM::SpecHelper let(:config) do {max_age: 18000, ip: '127.0.0.1', port: 3001, uuid: UUID.generate, boot_id: 1, config_id: 1, u_search_port: 1900} end [:alive, :update, :byebye].each do |type| it "should send 2 #{type} notify packets" do em do receiver = EM.open_datagram_socket(MULTICAST_IP, DISCOVERY_PORT, FakeMulticast) notifier = RUPNP::SSDP.notify(:root, type, config) EM.add_timer(1) do expect(receiver.packets).to have(2).items receiver.packets.each do |packet| expect(packet).to be_a_notify_packet(type) end receiver.close_connection done end end end end it 'should send configured number of notify packets' do em do foreach = Proc.new do |n, iter| receiver = EM.open_datagram_socket(MULTICAST_IP, DISCOVERY_PORT, FakeMulticast) cfg = config.merge!(try_number: n) notifier = RUPNP::SSDP.notify(:root, :alive, cfg) EM.add_timer(1) do expect(receiver.packets).to have(n).items receiver.close_connection iter.next end end after = Proc.new { done } EM::Iterator.new(3..5, 1).each(foreach, after) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rupnp-0.3.0 | spec/ssdp/notifier_spec.rb |
rupnp-0.2.2 | spec/ssdp/notifier_spec.rb |
rupnp-0.2.1 | spec/ssdp/notifier_spec.rb |
rupnp-0.2.0 | spec/ssdp/notifier_spec.rb |