Source

qemu-toolkit / spec / lib / qemu-toolkit / vnic_collection_spec.rb

require 'spec_helper'

describe QemuToolkit::VnicCollection do
  let(:coll) { described_class.new }

  describe "#normalize_mac_address" do
    it 'replaces 0a with a' do
      coll.normalize_mac_address('01:02:03:04:05:06:07:08:09:0a:0B:0C:0D:0e:0f').
        should == '1:2:3:4:5:6:7:8:9:a:b:c:d:e:f'
    end
  end
  describe "allocate" do
    let(:vnic) { flexmock(macaddr: '1:2:a', over: 'igb0') }
    before(:each) { coll << vnic }
    
    it "filters for normalized mac address" do
      coll.allocate('igb0', '01:02:0a').should == vnic
    end
  end
end