summaryrefslogtreecommitdiff
path: root/spec/unit/plugins/bsd/filesystem_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/plugins/bsd/filesystem_spec.rb')
-rw-r--r--spec/unit/plugins/bsd/filesystem_spec.rb33
1 files changed, 17 insertions, 16 deletions
diff --git a/spec/unit/plugins/bsd/filesystem_spec.rb b/spec/unit/plugins/bsd/filesystem_spec.rb
index e3d8be5e..f4982de3 100644
--- a/spec/unit/plugins/bsd/filesystem_spec.rb
+++ b/spec/unit/plugins/bsd/filesystem_spec.rb
@@ -21,7 +21,8 @@ require "spec_helper"
describe Ohai::System, "BSD filesystem plugin" do
let(:plugin) { get_plugin("filesystem") }
- before(:each) do
+
+ before do
allow(plugin).to receive(:collect_os).and_return(:freebsd)
allow(plugin).to receive(:shell_out).with("df").and_return(mock_shell_out(0, "", ""))
@@ -30,7 +31,7 @@ describe Ohai::System, "BSD filesystem plugin" do
end
describe "when gathering filesystem usage data from df" do
- before(:each) do
+ before do
@stdout = <<~DF
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ada0p2 9637788 3313504 5553264 37% /
@@ -46,55 +47,55 @@ describe Ohai::System, "BSD filesystem plugin" do
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
end
- it "should run df and df -iP" do
+ it "runs df and df -iP" do
expect(plugin).to receive(:shell_out).ordered.with("df").and_return(mock_shell_out(0, @stdout, ""))
expect(plugin).to receive(:shell_out).ordered.with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
plugin.run
end
- it "should set kb_size to value from df" do
+ it "sets kb_size to value from df" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:kb_size]).to eq("9637788")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_size]).to eq("9637788")
end
- it "should set kb_used to value from df" do
+ it "sets kb_used to value from df" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:kb_used]).to eq("3313504")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_used]).to eq("3313504")
end
- it "should set kb_available to value from df" do
+ it "sets kb_available to value from df" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:kb_available]).to eq("5553264")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_available]).to eq("5553264")
end
- it "should set percent_used to value from df" do
+ it "sets percent_used to value from df" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:percent_used]).to eq("37%")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:percent_used]).to eq("37%")
end
- it "should set mount to value from df" do
+ it "sets mount to value from df" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:mount]).to eq("/")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount]).to eq("/")
end
- it "should set total_inodes to value from df -iP" do
+ it "sets total_inodes to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:total_inodes]).to eq("1043326")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:total_inodes]).to eq("1043326")
end
- it "should set inodes_used to value from df -iP" do
+ it "sets inodes_used to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:inodes_used]).to eq("252576")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:inodes_used]).to eq("252576")
end
- it "should set inodes_available to value from df -iP" do
+ it "sets inodes_available to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:inodes_available]).to eq("790750")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:inodes_available]).to eq("790750")
@@ -102,7 +103,7 @@ describe Ohai::System, "BSD filesystem plugin" do
end
describe "when gathering mounted filesystem data from mount" do
- before(:each) do
+ before do
@stdout = <<~MOUNT
/dev/ada0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
@@ -110,24 +111,24 @@ describe Ohai::System, "BSD filesystem plugin" do
allow(plugin).to receive(:shell_out).with("mount -l").and_return(mock_shell_out(0, @stdout, ""))
end
- it "should run mount" do
+ it "runs mount" do
expect(plugin).to receive(:shell_out).with("mount -l").and_return(mock_shell_out(0, @stdout, ""))
plugin.run
end
- it "should set mount to value from mount" do
+ it "sets mount to value from mount" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:mount]).to eq("/")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount]).to eq("/")
end
- it "should set fs_type to value from mount" do
+ it "sets fs_type to value from mount" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:fs_type]).to eq("ufs")
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:fs_type]).to eq("ufs")
end
- it "should set mount_options to an array of values from mount" do
+ it "sets mount_options to an array of values from mount" do
plugin.run
expect(plugin[:filesystem]["/dev/ada0p2"][:mount_options]).to eq(["local", "journaled soft-updates"])
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount_options]).to eq(["local", "journaled soft-updates"])