summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-03-29 00:25:12 -0700
committerTim Smith <tsmith@chef.io>2018-04-17 10:37:34 -0700
commit9eaf02147e5780fdc246ceb67f3c603f6dbd8260 (patch)
tree87d24cdea7ff9a02a11d6ee478cb0e1a88776738 /spec
parenta007742eb897423efbaacc799dc07a8901a77273 (diff)
downloadohai-9eaf02147e5780fdc246ceb67f3c603f6dbd8260.tar.gz
Allow configuring what DMI IDs we whitelist
A lot of people want their OEM / IPMI dmi data. It’s super handy to have. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/plugins/dmi_spec.rb35
1 files changed, 18 insertions, 17 deletions
diff --git a/spec/unit/plugins/dmi_spec.rb b/spec/unit/plugins/dmi_spec.rb
index 9c855a9c..b7fa44d9 100644
--- a/spec/unit/plugins/dmi_spec.rb
+++ b/spec/unit/plugins/dmi_spec.rb
@@ -101,15 +101,16 @@ Chassis Information
EOS
describe Ohai::System, "plugin dmi" do
+ let(:plugin) { get_plugin("dmi") }
+ let(:stdout) { DMI_OUT }
+
before(:each) do
- @plugin = get_plugin("dmi")
- @stdout = DMI_OUT
- allow(@plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, @stdout, ""))
+ allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, stdout, ""))
end
- it "should run dmidecode" do
- expect(@plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, @stdout, ""))
- @plugin.run
+ it "runs dmidecode" do
+ expect(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, stdout, ""))
+ plugin.run
end
# Test some simple sample data
@@ -128,21 +129,21 @@ describe Ohai::System, "plugin dmi" do
},
}.each do |id, data|
data.each do |attribute, value|
- it "should have [:dmi][:#{id}][:#{attribute}] set" do
- @plugin.run
- expect(@plugin[:dmi][id][attribute]).to eql(value)
+ it "attribute [:dmi][:#{id}][:#{attribute}] is set" do
+ plugin.run
+ expect(plugin[:dmi][id][attribute]).to eql(value)
end
- it "should have [:dmi][:#{id}][:#{attribute}] set for windows output" do
- @stdout = convert_windows_output(DMI_OUT)
- expect(@plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, @stdout, ""))
- @plugin.run
- expect(@plugin[:dmi][id][attribute]).to eql(value)
+ it "attribute [:dmi][:#{id}][:#{attribute}] set for windows output" do
+ stdout = convert_windows_output(DMI_OUT)
+ expect(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, stdout, ""))
+ plugin.run
+ expect(plugin[:dmi][id][attribute]).to eql(value)
end
end
end
- it "should correctly ignore unwanted data" do
- @plugin.run
- expect(@plugin[:dmi][:base_board]).not_to have_key(:error_correction_type)
+ it "correctly ignores unwanted data" do
+ plugin.run
+ expect(plugin[:dmi][:base_board]).not_to have_key(:error_correction_type)
end
end