Sha256: 07a787d10b819605c189fcf29370f1d1b859a4de1ecb13ff44af6a6fbf0b1f89

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'

describe :Fru do

  before :all do
    @path = '/usr/local/bin'
  end

 before :each do
    allow_message_expectations_on_nil
    data = nil
    provider = "ipmitool"
    user = "ipmiuser"
    pass = "impipass"
    host = "ipmihost"
    allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")

    @conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
    @fru = @conn.fru

    File.open("spec/fixtures/#{provider}/fru.txt",'r') do |file|
      data = file.read
    end

    allow(@fru).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
    allow(@fru).to receive(:`).and_return(data)
    allow($?).to receive(:success?).and_return(true)

  end

  it "cmd should be ipmi-sensors with correct number of arguments" do
    @fru.list
    verify_ipmitool_command(@fru, 4, "#{@path}/ipmitool", 'fru')
  end

  it 'should return a list of unparsed frus' do
    expect(@fru.getfrus).not_to be_nil
  end

  it 'should return a list of fru names' do
    expect(@fru.names.count).to eq(13)
  end

  it "should return a list of parsed frus" do
    expect(@fru.list.count).to eq(13)
  end

  it 'should return a manufactor' do
    expect(@fru.product_manufacturer).to eq('HP')
  end

  it 'should return a product' do
    expect(@fru.product_name).to eq('ProLiant SL230s Gen8')
  end

  it 'should return a board serial' do
    expect(@fru.board_serial).to eq('USE238F0D0')
  end

  it 'should return a product serial' do
    expect(@fru.product_serial).to eq('USE238F0D0')
  end

  it 'should return a asset tag' do
    expect(@fru.product_asset_tag).to eq('000015B90F82')
  end

  it 'should return a fru using method missing' do
    @fru.names.each do |name|
      fru = @fru.send(name)
      expect(fru).to be_an_instance_of(Rubyipmi::Ipmitool::FruData)
      expect(fru[:name]).to eq(name)
    end
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyipmi-0.10.0 spec/unit/ipmitool/fru_spec.rb