Sha256: fd68fba723c6e056368eadcf1519d65d8a200f08b76a7e8b47ea390c3a5efe2f

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

require 'pione/test-helper'

describe Pione::Notification::Transmitter do
  it "should transmit a notification message by UDP broadcast" do
    message = Notification::Message.new("SPEC_NOTIFICATION_SENDER", "SPEC_TEST", {})

    transmitter = Notification::Transmitter.new(URI.parse("pnb://255.255.255.255:56000"))
    should.not.raise {transmitter.transmit(message)}
  end

  it "should send a notification message by UDP multicast" do
    message = Notification::Message.new("SPEC_NOTIFICATION_SENDER", "SPEC_TEST", {})

    transmitter = Notification::Transmitter.new(URI.parse("pnm://239.1.2.3:56000"))
    should.not.raise {transmitter.transmit(message)}
  end

  it "should send a notification message by UDP multicast with a specific interface" do
    message = Notification::Message.new("SPEC_NOTIFICATION_SENDER", "SPEC_TEST", {})

    transmitter = Notification::Transmitter.new(URI.parse("pnm://239.1.2.3:56000?if=127.0.0.1"))
    should.not.raise {transmitter.transmit(message)}
  end

  it "should send a notification by UDP unicast" do
    message = Notification::Message.new("SPEC_NOTIFICATION_SENDER", "SPEC_TEST", {})

    transmitter = Notification::Transmitter.new(URI.parse("pnu://127.0.0.1:56000"))
    should.not.raise {transmitter.transmit(message)}
  end

  it "should raise an argument error" do
    should.raise(ArgumentError) do
      Notification::Transmitter.new(URI.parse("http://127.0.0.1:56000"))
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pione-0.5.0 test/notification/spec_transmitter.rb
pione-0.5.0.alpha.2 test/notification/spec_transmitter.rb
pione-0.5.0.alpha.1 test/notification/spec_transmitter.rb
pione-0.4.2 test/notification/spec_transmitter.rb
pione-0.4.1 test/notification/spec_transmitter.rb
pione-0.4.0 test/notification/spec_transmitter.rb