spec/unit/hardwaremodel_spec.rb in facter-1.7.2 vs spec/unit/hardwaremodel_spec.rb in facter-1.7.3.rc1
- old
+ new
@@ -15,25 +15,40 @@
require 'facter/util/wmi'
before :each do
Facter.fact(:kernel).stubs(:value).returns("windows")
end
+ it "should detect i486" do
+ cpu = mock('cpu', :Architecture => 0)
+ cpu.expects(:Level).returns(4).twice
+ Facter::Util::WMI.expects(:execquery).returns([cpu])
+
+ Facter.fact(:hardwaremodel).value.should == "i486"
+ 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, :AddressWidth => 64)
+ cpu = mock('cpu', :Architecture => 9, :AddressWidth => 64, :Level => 6)
Facter::Util::WMI.expects(:execquery).returns([cpu])
Facter.fact(:hardwaremodel).value.should == "x64"
end
it "(#16948) reports i686 when a 32 bit OS is running on a 64 bit CPU" do
cpu = mock('cpu', :Architecture => 9, :AddressWidth => 32, :Level => 6)
+ Facter::Util::WMI.expects(:execquery).returns([cpu])
+
+ Facter.fact(:hardwaremodel).value.should == "i686"
+ end
+
+ it "(#20989) should report i686 when a 32 bit OS is running on a 64 bit CPU and when level is greater than 6 (and not something like i1586)" do
+ cpu = mock('cpu', :Architecture => 9, :AddressWidth => 32, :Level => 15)
Facter::Util::WMI.expects(:execquery).returns([cpu])
Facter.fact(:hardwaremodel).value.should == "i686"
end
end