spec/unit/plugins/c_spec.rb in ohai-15.2.5 vs spec/unit/plugins/c_spec.rb in ohai-15.3.1
- old
+ new
@@ -72,19 +72,19 @@
describe Ohai::System, "plugin c" do
let(:plugin) { get_plugin("c") }
- before(:each) do
+ before do
plugin[:languages] = Mash.new
# gcc
allow(plugin).to receive(:shell_out).with("gcc -v").and_return(mock_shell_out(0, "", C_GCC))
end
context "on AIX" do
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:aix)
allow(plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
end
# ibm xlc
@@ -121,12 +121,13 @@
plugin.run
expect(plugin[:languages][:c]).not_to have_key(:xlc)
end
end
+
context "on Darwin" do
- before(:each) do
+ before do
allow(plugin).to receive(:shell_out).with("/usr/bin/xcode-select -p").and_return(mock_shell_out(0, "", ""))
allow(plugin).to receive(:collect_os).and_return(:darwin)
end
it "shells out to see if xcode is installed" do
@@ -141,11 +142,11 @@
end
end
context "on Windows" do
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:windows)
allow(plugin).to receive(:shell_out).with("cl /\?").and_return(mock_shell_out(0, "", C_CL))
allow(plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
end
@@ -207,10 +208,10 @@
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
end
end
context "on Linux" do
- before(:each) do
+ before do
allow(plugin).to receive(:collect_os).and_return(:linux)
# glibc
allow(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC, ""))
allow(plugin).to receive(:shell_out).with("/lib64/libc.so.6").and_return(mock_shell_out(0, C_GLIBC, ""))
# sun pro