Sha256: 18a1b9fc3873d6846ba5dbcaf368cdb9238c8aac7f96f1fe66418e81b997e44d

Contents?: true

Size: 892 Bytes

Versions: 2

Compression:

Stored size: 892 Bytes

Contents

require 'spec_helper'

module NNCore
  describe "nn_term" do

    context "given an initialized library and" do

      context "given a valid socket" do
        before(:each) do
          @socket = LibNanomsg.nn_socket(AF_SP, NN_PUB)
        end

        after(:each) do
          LibNanomsg.nn_close(@socket)
        end

        it "makes subsequent calls to nn_send fail with ETERM" do
          LibNanomsg.nn_term
          rc = LibNanomsg.nn_send(0, "ABC", 3, 0)
          expect(rc).to eq(-1)
          expect(LibNanomsg.nn_errno).to eq(ETERM)
        end

#        it "makes subsequent calls to nn_recv fail with ETERM" do
#          LibNanomsg.nn_term
#          buffer = FFI::MemoryPointer.new(:pointer)
#          rc = LibNanomsg.nn_recv(@socket, buffer, NN_MSG, 0)
#          rc.should == -1
#          LibNanomsg.nn_errno.should == ETERM
#        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nn-core-0.4.0 spec/nn_term_spec.rb
nn-core-0.3.0 spec/nn_term_spec.rb