spec/louis_spec.rb in louis-2.0.6 vs spec/louis_spec.rb in louis-2.0.7

- old
+ new

@@ -31,10 +31,13 @@ let(:base_mac) { '00:12:34:00:00:00' } let(:partial_mac) { '3c:97:0e' } let(:unknown_mac) { 'c5:00:00:00:00:00' } let(:local_mac) { '3e:97:0e' } let(:multicast_mac) { '3d:97:0e' } + let(:multi_match_mac) { 'E4:95:6E:40:00:00'} + let(:most_specific_match) { 'Guang Lian Zhi Tong Technology Limited'} + let(:least_specific_match) { 'IEEE Registration Authority'} it 'should return a hash' do expect(Louis.lookup(base_mac)).to be_a(Hash) end @@ -70,9 +73,14 @@ expect(Louis.lookup(unknown_mac)['short_vendor']).to eq('Unknown') end it 'should return "Unknown" as the long vendor string for unknown MAC prefixes' do expect(Louis.lookup(unknown_mac)['long_vendor']).to eq('Unknown') + end + + it 'should return the most specific vendor match for MAC prefixes that match multiple mask keys' do + expect(Louis.lookup(multi_match_mac)['long_vendor']).to_not eq(least_specific_match) + expect(Louis.lookup(multi_match_mac)['long_vendor']).to eq(most_specific_match) end end # For future reference, these may change and are depedent on the # specifications in the data file. This of these as the slash-suffixes that