~gandelman-a/ubuntu/precise/facter/merge922788

« back to all changes in this revision

Viewing changes to spec/unit/memory_spec.rb

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2011-10-18 10:32:42 UTC
  • mfrom: (1.3.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: package-import@ubuntu.com-20111018103242-ag8i8vejfp8v7b1b
Tags: upstream-1.6.1
ImportĀ upstreamĀ versionĀ 1.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
describe "Memory facts" do
8
8
    before do
9
 
        Facter.loadfacts
 
9
        # We need these facts loaded, but they belong to a file with a
 
10
        # different name, so load the file explicitly.
 
11
        Facter.collection.loader.load(:memory)
10
12
    end
11
13
 
12
14
    after do
42
44
        swapusage =~ /\(encrypted\)/
43
45
        Facter.fact(:swapencrypted).value.should == true
44
46
    end
 
47
 
 
48
    describe "on Windows" do
 
49
        before :each do
 
50
             Facter.clear
 
51
             Facter.fact(:kernel).stubs(:value).returns("windows")
 
52
             Facter.collection.loader.load(:memory)
 
53
 
 
54
             require 'facter/util/wmi'
 
55
        end
 
56
 
 
57
        it "should return free memory" do
 
58
             os = stubs 'os'
 
59
             os.stubs(:FreePhysicalMemory).returns("3415624")
 
60
             Facter::Util::WMI.stubs(:execquery).returns([os])
 
61
 
 
62
             Facter.fact(:MemoryFree).value.should == '3.26 GB'
 
63
        end
 
64
 
 
65
        it "should return total memory" do
 
66
             computer = stubs 'computer'
 
67
             computer.stubs(:TotalPhysicalMemory).returns("4193837056")
 
68
             Facter::Util::WMI.stubs(:execquery).returns([computer])
 
69
 
 
70
             Facter.fact(:MemoryTotal).value.should == '3.91 GB'
 
71
        end
 
72
    end
45
73
end