spec/interfaces/udp_interface_spec.rb in cosmos-3.3.3 vs spec/interfaces/udp_interface_spec.rb in cosmos-3.4.0

- old
+ new

@@ -20,21 +20,21 @@ end it "is not writeable if no write port given" do i = UdpInterface.new('localhost','nil','8889') expect(i.name).to eql "Cosmos::UdpInterface" - expect(i.write_allowed?).to be_falsey - expect(i.write_raw_allowed?).to be_falsey - expect(i.read_allowed?).to be_truthy + expect(i.write_allowed?).to be false + expect(i.write_raw_allowed?).to be false + expect(i.read_allowed?).to be true end it "is not readable if no read port given" do i = UdpInterface.new('localhost','8888','nil') expect(i.name).to eql "Cosmos::UdpInterface" - expect(i.write_allowed?).to be_truthy - expect(i.write_raw_allowed?).to be_truthy - expect(i.read_allowed?).to be_falsey + expect(i.write_allowed?).to be true + expect(i.write_raw_allowed?).to be true + expect(i.read_allowed?).to be false end end describe "connect, connected?, disconnect" do it "creates a UdpWriteSocket and UdpReadSocket if both given" do @@ -45,43 +45,43 @@ expect(read).to receive(:closed?).and_return(false) expect(read).to receive(:close) expect(UdpWriteSocket).to receive(:new).and_return(write) expect(UdpReadSocket).to receive(:new).and_return(read) i = UdpInterface.new('localhost','8888','8889') - expect(i.connected?).to be_falsey + expect(i.connected?).to be false i.connect - expect(i.connected?).to be_truthy + expect(i.connected?).to be true i.disconnect - expect(i.connected?).to be_falsey + expect(i.connected?).to be false end it "creates a UdpWriteSocket if write port given" do write = double("write") expect(write).to receive(:closed?).and_return(false) expect(write).to receive(:close) expect(UdpWriteSocket).to receive(:new).and_return(write) expect(UdpReadSocket).to_not receive(:new) i = UdpInterface.new('localhost','8888','nil') - expect(i.connected?).to be_falsey + expect(i.connected?).to be false i.connect - expect(i.connected?).to be_truthy + expect(i.connected?).to be true i.disconnect - expect(i.connected?).to be_falsey + expect(i.connected?).to be false end it "creates a UdpReadSocket if read port given" do read = double("read") expect(read).to receive(:closed?).and_return(false) expect(read).to receive(:close) expect(UdpWriteSocket).to_not receive(:new) expect(UdpReadSocket).to receive(:new).and_return(read) i = UdpInterface.new('localhost','nil','8889') - expect(i.connected?).to be_falsey + expect(i.connected?).to be false i.connect - expect(i.connected?).to be_truthy + expect(i.connected?).to be true i.disconnect - expect(i.connected?).to be_falsey + expect(i.connected?).to be false end end describe "disconnect" do it "rescues IOError from close" do @@ -92,24 +92,24 @@ expect(read).to receive(:closed?).and_return(false) expect(read).to receive(:close).and_raise(IOError) expect(UdpWriteSocket).to receive(:new).and_return(write) expect(UdpReadSocket).to receive(:new).and_return(read) i = UdpInterface.new('localhost','8888','8889') - expect(i.connected?).to be_falsey + expect(i.connected?).to be false i.connect - expect(i.connected?).to be_truthy + expect(i.connected?).to be true i.disconnect - expect(i.connected?).to be_falsey + expect(i.connected?).to be false end end describe "read" do it "stops the read thread if no read port given" do i = UdpInterface.new('localhost','8888','nil') thread = Thread.new { i.read } sleep 0.1 - expect(thread.stop?).to be_truthy + expect(thread.stop?).to be true Cosmos.kill_thread(nil, thread) end it "stops the read thread if there is an IOError" do read = double("read") @@ -117,10 +117,10 @@ expect(UdpReadSocket).to receive(:new).and_return(read) i = UdpInterface.new('localhost','nil','8889') i.connect thread = Thread.new { i.read } sleep 0.1 - expect(thread.stop?).to be_truthy + expect(thread.stop?).to be true Cosmos.kill_thread(nil, thread) end it "counts the packets received" do read = double("read")