Skip to content

Commit

Permalink
Add specs around random exceptions in walker and remove extra method …
Browse files Browse the repository at this point in the history
…in pdu
  • Loading branch information
zenonas committed Oct 27, 2014
1 parent 2d35614 commit 56db2d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/snmpjr/pdu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@ def create oids
pdu
end

def self.createPDU target
Snmpjr::Wrappers::PDU.new
end

end
end
13 changes: 13 additions & 0 deletions spec/snmpjr/walker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,20 @@
subject.walk oid
}.to raise_error Snmpjr::TargetTimeoutError
end
end

context 'when a random error occurs' do
let(:tree_event_1) { double :tree_event_1 }
before do
allow(tree_event_1).to receive(:is_error?).and_return true
allow(tree_event_1).to receive(:error_message).and_return 'noAccess'
end

it 'raises a runtime error' do
expect{
subject.walk oid
}.to raise_error RuntimeError
end
end

context 'when a walk returns no variable bindings' do
Expand Down

0 comments on commit 56db2d2

Please sign in to comment.