Sha256: e4880d4b1b38ee7683b0367fd5c14bc4ab8707f57532bee53a640370bbc7fd3a

Contents?: true

Size: 900 Bytes

Versions: 20

Compression:

Stored size: 900 Bytes

Contents

#!/usr/bin/env ruby

require 'spec_helper'
require 'facter'

describe "Hardwaremodel fact" do
  it "should match uname -m by default" do
    Facter.fact(:kernel).stubs(:value).returns("Darwin")
    Facter::Util::Resolution.stubs(:exec).with("uname -m").returns("Inky")

    Facter.fact(:hardwaremodel).value.should == "Inky"
  end

  describe "on Windows" do
    require 'facter/util/wmi'
    before :each do
      Facter.fact(:kernel).stubs(:value).returns("windows")
    end

    it "should detect i686" do
      cpu = mock('cpu', :Architecture => 0, :Level => 6)
      Facter::Util::WMI.expects(:execquery).returns([cpu])

      Facter.fact(:hardwaremodel).value.should == "i686"
    end

    it "should detect x64" do
      cpu = mock('cpu', :Architecture => 9)
      Facter::Util::WMI.expects(:execquery).returns([cpu])

      Facter.fact(:hardwaremodel).value.should == "x64"
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/facter-1.6.17/spec/unit/hardwaremodel_spec.rb
facter-1.6.18 spec/unit/hardwaremodel_spec.rb
facter-1.6.18.rc1 spec/unit/hardwaremodel_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/facter-1.6.17/spec/unit/hardwaremodel_spec.rb
facter-1.6.17 spec/unit/hardwaremodel_spec.rb
facter-1.6.17.rc1 spec/unit/hardwaremodel_spec.rb
facter-1.6.16 spec/unit/hardwaremodel_spec.rb
facter-1.6.15 spec/unit/hardwaremodel_spec.rb
facter-1.6.15.rc1 spec/unit/hardwaremodel_spec.rb
facter-1.6.14 spec/unit/hardwaremodel_spec.rb
facter-1.6.14.rc1 spec/unit/hardwaremodel_spec.rb
facter-1.6.13 spec/unit/hardwaremodel_spec.rb
facter-1.6.13.rc1 spec/unit/hardwaremodel_spec.rb
facter-1.6.12 spec/unit/hardwaremodel_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/facter-1.6.11/spec/unit/hardwaremodel_spec.rb
facter-1.6.12.rc2 spec/unit/hardwaremodel_spec.rb
facter-1.6.12.rc1 spec/unit/hardwaremodel_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/facter-1.6.11/spec/unit/hardwaremodel_spec.rb
facter-1.6.11 spec/unit/hardwaremodel_spec.rb
facter-1.6.10 spec/unit/hardwaremodel_spec.rb