Sha256: ede63ab4a6ee4e09bc174dd1e025b9946e0b17eb2f57154dde3456dd7d8634b2

Contents?: true

Size: 811 Bytes

Versions: 12

Compression:

Stored size: 811 Bytes

Contents

require 'spec_helper'

describe "NIO acceptables" do
  shared_context "an NIO acceptable" do
    let(:selector) { NIO::Selector.new }

    it "selects for read readiness" do
      waiting_monitor = selector.register(unacceptable_subject, :r)
      ready_monitor   = selector.register(acceptable_subject, :r)

      ready_monitors = selector.select
      ready_monitors.should include ready_monitor
      ready_monitors.should_not include waiting_monitor
    end
  end

  describe TCPServer do
    let(:tcp_port) { 23456 }

    let :acceptable_subject do
      server = TCPServer.new("localhost", tcp_port)
      TCPSocket.open("localhost", tcp_port)
      server
    end

    let :unacceptable_subject do
      TCPServer.new("localhost", tcp_port + 1)
    end

    it_behaves_like "an NIO acceptable"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nio4r-1.0.0-java spec/nio/acceptables_spec.rb
nio4r-1.0.0 spec/nio/acceptables_spec.rb
nio4r-0.5.0-java spec/nio/acceptables_spec.rb
nio4r-0.5.0 spec/nio/acceptables_spec.rb
nio4r-0.4.6-java spec/nio/acceptables_spec.rb
nio4r-0.4.6 spec/nio/acceptables_spec.rb
nio4r-0.4.5-java spec/nio/acceptables_spec.rb
nio4r-0.4.5 spec/nio/acceptables_spec.rb
nio4r-0.4.4-java spec/nio/acceptables_spec.rb
nio4r-0.4.4 spec/nio/acceptables_spec.rb
nio4r-0.4.3 spec/nio/acceptables_spec.rb
nio4r-0.4.3-java spec/nio/acceptables_spec.rb