Sha256: ad109df58c11ed125ecb92e7a5a58b35b0b08b69dbb4fe8e4db58006b7335462
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
require production_code describe Snmpjr::Session do describe "#send" do let(:transport_mapping) { double Snmpjr::Wrappers::Transport::DefaultUdpTransportMapping } let(:target) { double :target } let(:pdu) { double :pdu } let(:result) { double :result } let(:snmp_session) { double Snmpjr::Wrappers::Snmp } before do allow(Snmpjr::Wrappers::Transport::DefaultUdpTransportMapping).to receive(:new).and_return transport_mapping allow(Snmpjr::Wrappers::Snmp).to receive(:new).and_return snmp_session allow(snmp_session).to receive(:send).and_return result allow(result).to receive_message_chain('response.variable_bindings.first.variable.to_s') allow(snmp_session).to receive(:listen) allow(snmp_session).to receive(:close) end it "opens a new SNMP4J session with Udp transport mapping" do expect(Snmpjr::Wrappers::Snmp).to receive(:new).with(transport_mapping) subject.send(pdu, target) end it "sends the pdu to the target" do expect(snmp_session).to receive(:send).with(pdu, target) subject.send(pdu, target) end it "closes the connection" do expect(snmp_session).to receive(:close) subject.send(pdu, target) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
snmpjr-0.1.0-java | spec/snmpjr/session_spec.rb |