require 'test_helper'
require 'simplereactor'

describe SimpleReactor do

  it "sets reactor to a select() based reactor when instructed to do so" do
    SimpleReactor.use_engine :select

    SimpleReactor.Reactor.must_be_same_as SimpleReactor::Select
  end

  it "sets reactor to a nio4r based reactor, if nio4r is available" do
    SimpleReactor.use_engine :nio

    SimpleReactor.Reactor.must_be_same_as SimpleReactor::Nio if Object.const_defined? :NIO
  end


end

require 'test_helper'
require 'simplereactor'

describe SimpleReactor do

  it "sets reactor to a select() based reactor when instructed to do so" do
    SimpleReactor.use_engine :select

    SimpleReactor.Reactor.must_be_same_as SimpleReactor::Select
  end

  it "sets reactor to a nio4r based reactor, if nio4r is available" do
    SimpleReactor.use_engine :nio

    if Object.const_defined? :NIO
      SimpleReactor.Reactor.must_be_same_as SimpleReactor::Nio

      SimpleReactor.use_engine :select

      SimpleReactor.Reactor.must_be_same_as SimpleReactor::Select

      SimpleReactor.use_engine :nio

      SimpleReactor.Reactor.must_be_same_as SimpleReactor::Select
    end
  end


end

Add a basic test for toggling from one engine type to another, and back.
Add a basic test for toggling from one engine type to another, and back.
