summaryrefslogtreecommitdiff
path: root/spec/unit/plugins/darwin/cpu_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/plugins/darwin/cpu_spec.rb')
-rw-r--r--spec/unit/plugins/darwin/cpu_spec.rb29
1 files changed, 15 insertions, 14 deletions
diff --git a/spec/unit/plugins/darwin/cpu_spec.rb b/spec/unit/plugins/darwin/cpu_spec.rb
index 1c0313c4..f6104146 100644
--- a/spec/unit/plugins/darwin/cpu_spec.rb
+++ b/spec/unit/plugins/darwin/cpu_spec.rb
@@ -19,8 +19,9 @@
require "spec_helper"
describe Ohai::System, "Darwin cpu plugin" do
+ let(:plugin) { get_plugin("cpu") }
+
before do
- @plugin = get_plugin("cpu")
@stdout = <<~CTL
hw.ncpu: 8
hw.byteorder: 1234
@@ -77,48 +78,48 @@ describe Ohai::System, "Darwin cpu plugin" do
machdep.cpu.max_basic: 13
CTL
- allow(@plugin).to receive(:collect_os).and_return(:darwin)
- allow(@plugin).to receive(:shell_out).with("sysctl hw machdep").and_return(mock_shell_out(0, @stdout, ""))
- @plugin.run
+ allow(plugin).to receive(:collect_os).and_return(:darwin)
+ allow(plugin).to receive(:shell_out).with("sysctl hw machdep").and_return(mock_shell_out(0, @stdout, ""))
+ plugin.run
end
it "sets cpu[:cores] to 4" do
- expect(@plugin[:cpu][:cores]).to eq(4)
+ expect(plugin[:cpu][:cores]).to eq(4)
end
it "sets cpu[:total] to 8" do
- expect(@plugin[:cpu][:total]).to eq(8)
+ expect(plugin[:cpu][:total]).to eq(8)
end
it "sets cpu[:real] to 1" do
- expect(@plugin[:cpu][:real]).to eq(1)
+ expect(plugin[:cpu][:real]).to eq(1)
end
it "sets cpu[:mhz] to 2800" do
- expect(@plugin[:cpu][:mhz]).to eq(2800)
+ expect(plugin[:cpu][:mhz]).to eq(2800)
end
it "sets cpu[:vendor_id] to GenuineIntel" do
- expect(@plugin[:cpu][:vendor_id]).to eq("GenuineIntel")
+ expect(plugin[:cpu][:vendor_id]).to eq("GenuineIntel")
end
it "sets cpu[:model_name] to Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz" do
- expect(@plugin[:cpu][:model_name]).to eq("Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz")
+ expect(plugin[:cpu][:model_name]).to eq("Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz")
end
it "sets cpu[:model] to 70" do
- expect(@plugin[:cpu][:model]).to eq(70)
+ expect(plugin[:cpu][:model]).to eq(70)
end
it "sets cpu[:family] to 6" do
- expect(@plugin[:cpu][:family]).to eq(6)
+ expect(plugin[:cpu][:family]).to eq(6)
end
it "sets cpu[:stepping] to 1" do
- expect(@plugin[:cpu][:stepping]).to eq(1)
+ expect(plugin[:cpu][:stepping]).to eq(1)
end
it "sets cpu[:flags] to array of flags" do
- expect(@plugin[:cpu][:flags]).to eq(["fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "clfsh", "ds", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "htt", "tm", "pbe", "sse3", "pclmulqdq", "dtes64", "mon", "dscpl", "vmx", "smx", "est", "tm2", "ssse3", "fma", "cx16", "tpr", "pdcm", "sse4.1", "sse4.2", "x2apic", "movbe", "popcnt", "aes", "pcid", "xsave", "osxsave", "seglim64", "tsctmr", "avx1.0", "rdrand", "f16c"])
+ expect(plugin[:cpu][:flags]).to eq(["fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "clfsh", "ds", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "htt", "tm", "pbe", "sse3", "pclmulqdq", "dtes64", "mon", "dscpl", "vmx", "smx", "est", "tm2", "ssse3", "fma", "cx16", "tpr", "pdcm", "sse4.1", "sse4.2", "x2apic", "movbe", "popcnt", "aes", "pcid", "xsave", "osxsave", "seglim64", "tsctmr", "avx1.0", "rdrand", "f16c"])
end
end