Sha256: 030541c338d9aa3f434fd3dc30f833f57195ef5126fe97bd79ee2debdcb76f7c

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

require production_code

describe Snmpjr::PduV2C do
  describe '#create' do

    let(:pdu) { double Snmpjr::Wrappers::PDU }
    let(:oid_1) { double Snmpjr::Wrappers::SMI::OID }
    let(:oid_2) { double Snmpjr::Wrappers::SMI::OID }
    let(:variable_binding_1) { double Snmpjr::Wrappers::SMI::VariableBinding }
    let(:variable_binding_2) { 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).with('1.2.3.4').and_return oid_1
      allow(Snmpjr::Wrappers::SMI::OID).to receive(:new).with('5.6.7.8').and_return oid_2
      allow(Snmpjr::Wrappers::SMI::VariableBinding).to receive(:new).with(oid_1).and_return variable_binding_1
      allow(Snmpjr::Wrappers::SMI::VariableBinding).to receive(:new).with(oid_2).and_return variable_binding_2
      allow(pdu).to receive(:type=)
      allow(pdu).to receive(:add)
    end
    it 'creates a GET Pdu' do
      expect(pdu).to receive(:type=).with(Snmpjr::PduV2C::Constants::GET)
      subject.create ['1.2.3.4']
    end

    it 'adds an SMI variable binding containing an oid to the pdu' do
      expect(pdu).to receive(:add).with variable_binding_1
      expect(pdu).to receive(:add).with variable_binding_2
      subject.create ['1.2.3.4', '5.6.7.8']
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
snmpjr-0.3.3-java spec/snmpjr/pdu_v2c_spec.rb
snmpjr-0.3.2-java spec/snmpjr/pdu_v2c_spec.rb
snmpjr-0.3.1-java spec/snmpjr/pdu_v2c_spec.rb
snmpjr-0.3.0-java spec/snmpjr/pdu_v2c_spec.rb