Sha256: 548a5ed29d4f35669cc943a7bdeb046c18cc0e186f60e3dcb5fbf7123e98044a

Contents?: true

Size: 828 Bytes

Versions: 42

Compression:

Stored size: 828 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

RSpec.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
      expect(ready_monitors).to include ready_monitor
      expect(ready_monitors).not_to include waiting_monitor
    end
  end

  describe TCPServer do
    let :acceptable_subject do
      server = TCPServer.new("127.0.0.1", 0)
      TCPSocket.open("127.0.0.1", server.local_address.ip_port)
      server
    end

    let :unacceptable_subject do
      TCPServer.new("127.0.0.1", 0)
    end

    it_behaves_like "an NIO acceptable"
  end
end

Version data entries

42 entries across 39 versions & 9 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/nio4r-2.5.8/spec/nio/acceptables_spec.rb
nio4r-2.6.0-java spec/nio/acceptables_spec.rb
nio4r-2.6.0 spec/nio/acceptables_spec.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/nio4r-2.5.8/spec/nio/acceptables_spec.rb
nio4r-2.5.9-java spec/nio/acceptables_spec.rb
nio4r-2.5.9 spec/nio/acceptables_spec.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/nio4r-2.5.8/spec/nio/acceptables_spec.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/nio4r-2.5.8/spec/nio/acceptables_spec.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/nio4r-2.5.7/spec/nio/acceptables_spec.rb
nio4r-2.5.8-java spec/nio/acceptables_spec.rb
nio4r-2.5.8 spec/nio/acceptables_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/nio4r-2.5.4/spec/nio/acceptables_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/nio4r-2.5.7/spec/nio/acceptables_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/nio4r-2.5.5/spec/nio/acceptables_spec.rb
nio4r-2.5.7-java spec/nio/acceptables_spec.rb
nio4r-2.5.7 spec/nio/acceptables_spec.rb
nio4r-2.5.6-java spec/nio/acceptables_spec.rb
nio4r-2.5.6 spec/nio/acceptables_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/nio4r-2.5.4/spec/nio/acceptables_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/nio4r-2.5.5/spec/nio/acceptables_spec.rb