summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-08-07 16:00:22 -0700
committerTim Smith <tsmith84@gmail.com>2020-08-07 16:00:22 -0700
commit803a230286b0637208edc96cb0eff86f40b34b24 (patch)
tree031f0f56b8883ada7466cd1aad056854f2876075 /spec
parentae3f94030dc67d3484f2052fbdb00addd3509a72 (diff)
downloadohai-803a230286b0637208edc96cb0eff86f40b34b24.tar.gz
Make sure /proc/cmdline exists before reading itrubocop_Performance_RegexpMatch
Don't run match? against nil Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/plugins/scaleway_spec.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/spec/unit/plugins/scaleway_spec.rb b/spec/unit/plugins/scaleway_spec.rb
index 713a8312..f10f1ecb 100644
--- a/spec/unit/plugins/scaleway_spec.rb
+++ b/spec/unit/plugins/scaleway_spec.rb
@@ -22,7 +22,7 @@ describe Ohai::System, "plugin scaleway" do
before do
allow(plugin).to receive(:hint?).with("scaleway").and_return(false)
- allow(File).to receive(:read).with("/proc/cmdline").and_return(false)
+ allow(File).to receive(:exist?).with("/proc/cmdline").and_return(false)
end
shared_examples_for "!scaleway" do
@@ -84,6 +84,7 @@ describe Ohai::System, "plugin scaleway" do
describe "with scaleway cmdline" do
before do
+ allow(File).to receive(:exist?).with("/proc/cmdline").and_return(true)
allow(File).to receive(:read).with("/proc/cmdline").and_return("initrd=initrd showopts console=ttyS0,115200 nousb vga=0 root=/dev/vda scaleway boot=local")
end