Class: Sloe::Expectations::Junos::HaveAllOspfNeighborsAs
- Inherits:
-
Object
- Object
- Sloe::Expectations::Junos::HaveAllOspfNeighborsAs
- Defined in:
- lib/sloe/expectations.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(state) ⇒ HaveAllOspfNeighborsAs
constructor
A new instance of HaveAllOspfNeighborsAs.
- #match(actual) ⇒ Object
Constructor Details
#initialize(state) ⇒ HaveAllOspfNeighborsAs
Returns a new instance of HaveAllOspfNeighborsAs.
73 74 75 |
# File 'lib/sloe/expectations.rb', line 73 def initialize(state) @state = state end |
Instance Method Details
#failure_message ⇒ Object
88 89 90 |
# File 'lib/sloe/expectations.rb', line 88 def @no_match end |
#match(actual) ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/sloe/expectations.rb', line 77 def match(actual) data = XmlSimple.xml_in(actual.to_xml) @no_match = data['ospf-neighbor'].select do |neighbor| if neighbor['ospf-neighbor-state'][0] != @state "#{neighbor['neighbor-address'][0]} state is #{neighbor['os pf-neighbor-state'][0]}" end end @no_match.size == 0 end |