Sha256: 3424c658c4675e7b6efb96f7ebf92f277499538c9e8063f6882e81bb052850c8

Contents?: true

Size: 586 Bytes

Versions: 2

Compression:

Stored size: 586 Bytes

Contents

require 'spec_helper'

module NNCore
  describe "nn_close" do

    context "given an initialized library and" do

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

        it "returns 0" do
          expect(LibNanomsg.nn_close(@socket)).to be_zero
        end

      end

      context "given an invalid file descriptor" do

        it "returns -1 and sets nn_errno to EBADF" do
          expect(LibNanomsg.nn_close(0)).to eq(-1)
          expect(LibNanomsg.nn_errno).to eq(EBADF)
        end

      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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