Sha256: 25cf827998c74c238d8e98d2707ba7e4bd0929a514a4751262712e5b0034f354

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require production_code

describe Snmpjr::Pdu do
  describe "#create" do

    let(:pdu) { double Snmpjr::Wrappers::PDU }
    let(:oid) { double Snmpjr::Wrappers::SMI::OID }
    let(:variable_binding) { double Snmpjr::Wrappers::SMI::VariableBinding }

    before do
      allow(Snmpjr::Wrappers::PDU).to receive(:new).and_return pdu
      allow(Snmpjr::Wrappers::SMI::OID).to receive(:new).and_return oid
      allow(Snmpjr::Wrappers::SMI::VariableBinding).to receive(:new).and_return variable_binding
      allow(pdu).to receive(:type=)
      allow(pdu).to receive(:add)
    end
    it "creates a GET Pdu" do
      expect(pdu).to receive(:type=).with(Snmpjr::Pdu::Constants::GET)
      subject.create '1.2.3.4'
    end

    it "adds an SMI variable binding containing an oid to the pdu" do
      expect(Snmpjr::Wrappers::SMI::OID).to receive(:new).with('1.2.3.4')
      expect(Snmpjr::Wrappers::SMI::VariableBinding).to receive(:new).with(oid)
      expect(pdu).to receive(:add).with variable_binding
      subject.create '1.2.3.4'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
snmpjr-0.1.4-java spec/snmpjr/pdu_spec.rb
snmpjr-0.1.2-java spec/snmpjr/pdu_spec.rb
snmpjr-0.1.3-java spec/snmpjr/pdu_spec.rb
snmpjr-0.1.0-java spec/snmpjr/pdu_spec.rb