summaryrefslogtreecommitdiff
path: root/spec/unit/plugins/aix/uptime_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/plugins/aix/uptime_spec.rb')
-rw-r--r--spec/unit/plugins/aix/uptime_spec.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/unit/plugins/aix/uptime_spec.rb b/spec/unit/plugins/aix/uptime_spec.rb
index 3023d41f..a6d9bc9f 100644
--- a/spec/unit/plugins/aix/uptime_spec.rb
+++ b/spec/unit/plugins/aix/uptime_spec.rb
@@ -19,24 +19,24 @@
require "spec_helper"
describe Ohai::System, "Aix plugin uptime" do
+ let(:plugin) { get_plugin("aix/uptime") }
before do
- @plugin = get_plugin("aix/uptime")
- allow(@plugin).to receive(:collect_os).and_return(:aix)
- allow(@plugin).to receive(:shell_out).and_call_original
+ allow(plugin).to receive(:collect_os).and_return(:aix)
+ allow(plugin).to receive(:shell_out).and_call_original
end
it "sets uptime_seconds and uptime standard case" do
- allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, "1148-20:54:50", nil))
- @plugin.run
- expect(@plugin[:uptime_seconds]).to eq(99262490)
- expect(@plugin[:uptime]).to eq("1148 days 20 hours 54 minutes 50 seconds")
+ allow(plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, "1148-20:54:50", nil))
+ plugin.run
+ expect(plugin[:uptime_seconds]).to eq(99262490)
+ expect(plugin[:uptime]).to eq("1148 days 20 hours 54 minutes 50 seconds")
end
it "sets uptime_seconds and uptime in the whitespace case" do
- allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, " 2-20:54:50", nil))
- @plugin.run
- expect(@plugin[:uptime_seconds]).to eq(248090)
- expect(@plugin[:uptime]).to eq("2 days 20 hours 54 minutes 50 seconds")
+ allow(plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, " 2-20:54:50", nil))
+ plugin.run
+ expect(plugin[:uptime_seconds]).to eq(248090)
+ expect(plugin[:uptime]).to eq("2 days 20 hours 54 minutes 50 seconds")
end
end