Sha256: 562d013825c4693c56871cefe45ab4f3041e8dc06b12d16bc70ef467ffe6e630

Contents?: true

Size: 878 Bytes

Versions: 11

Compression:

Stored size: 878 Bytes

Contents

require 'spec_helper'

describe Celluloid::IO::UDPSocket do
  let(:payload) { 'ohai' }
  subject do
    Celluloid::IO::UDPSocket.new.tap do |sock|
      sock.bind example_addr, example_port
    end
  end

  after { subject.close }

  context "inside Celluloid::IO" do
    it "should be evented" do
      within_io_actor { Celluloid::IO.evented? }.should be_true
    end

    it "sends and receives packets" do
      within_io_actor do
        subject.send payload, 0, example_addr, example_port
        subject.recvfrom(payload.size).first.should == payload
      end
    end
  end

  context "outside Celluloid::IO" do
    it "should be blocking" do
      Celluloid::IO.should_not be_evented
    end

    it "sends and receives packets" do
      subject.send payload, 0, example_addr, example_port
      subject.recvfrom(payload.size).first.should == payload
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
celluloid-io-0.16.2 spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.16.1 spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.16.0 spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.16.0.pre2 spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.16.0.pre spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.15.0 spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.15.0.pre2 spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.15.0.pre spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.14.1 spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.14.0 spec/celluloid/io/udp_socket_spec.rb
celluloid-io-0.14.0.pre spec/celluloid/io/udp_socket_spec.rb