|
7 | 7 |
|
8 | 8 | describe Process::Metrics::Host::Memory do |
9 | 9 | with ".capture" do |
10 | | - it "returns a struct with total, used, free when supported" do |
| 10 | + it "returns a struct with total_size, used_size, free_size when supported" do |
11 | 11 | host = Process::Metrics::Host::Memory.capture |
12 | 12 | skip "Host::Memory is not available on this platform" unless host |
13 | 13 | expect(host).to be_a(Process::Metrics::Host::Memory) |
14 | | - expect(host.total).to be_a(Integer) |
15 | | - expect(host.total).to be > 0 |
16 | | - expect(host.used).to be_a(Integer) |
17 | | - expect(host.used).to be >= 0 |
18 | | - expect(host.free).to be_a(Integer) |
19 | | - expect(host.free).to be >= 0 |
20 | | - expect(host.used + host.free).to be == host.total |
| 14 | + expect(host.total_size).to be_a(Integer) |
| 15 | + expect(host.total_size).to be > 0 |
| 16 | + expect(host.used_size).to be_a(Integer) |
| 17 | + expect(host.used_size).to be >= 0 |
| 18 | + expect(host.free_size).to be_a(Integer) |
| 19 | + expect(host.free_size).to be >= 0 |
| 20 | + expect(host.used_size + host.free_size).to be == host.total_size |
21 | 21 | end |
22 | 22 |
|
23 | | - it "may include swap_total and swap_used" do |
| 23 | + it "may include swap_total_size and swap_used_size" do |
24 | 24 | host = Process::Metrics::Host::Memory.capture |
25 | 25 | skip "Host::Memory is not available on this platform" unless host |
26 | | - if host.swap_total |
27 | | - expect(host.swap_total).to be_a(Integer) |
28 | | - expect(host.swap_used).to be_a(Integer) if host.swap_used |
| 26 | + if host.swap_total_size |
| 27 | + expect(host.swap_total_size).to be_a(Integer) |
| 28 | + expect(host.swap_used_size).to be_a(Integer) if host.swap_used_size |
29 | 29 | end |
30 | 30 | end |
31 | 31 |
|
|
34 | 34 | skip "Host::Memory is not available on this platform" unless host |
35 | 35 | json = host.to_json |
36 | 36 | parsed = JSON.parse(json) |
37 | | - expect(parsed).to have_keys("total", "used", "free") |
| 37 | + expect(parsed).to have_keys("total_size", "used_size", "free_size") |
38 | 38 | end |
39 | 39 | end |
40 | 40 |
|
|
0 commit comments