diff options
author | Tim Smith <tsmith84@gmail.com> | 2019-08-16 13:15:22 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2019-08-16 13:15:22 -0700 |
commit | 54b3cc831750805f19f838d60dea25e23dfa2e8c (patch) | |
tree | 81f539fca05ca2d0ed0761011913cd852b46d450 /spec/functional/plugins | |
parent | 038fd847c6d75dfaf6e60b67de185732aa245cc3 (diff) | |
download | ohai-rspec.tar.gz |
rspec updates from rubocop-rspecrspec
Autocorrects for a few different things that rubocop-rspec identified.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec/functional/plugins')
-rw-r--r-- | spec/functional/plugins/powershell_spec.rb | 16 | ||||
-rw-r--r-- | spec/functional/plugins/root_group_spec.rb | 2 | ||||
-rw-r--r-- | spec/functional/plugins/windows/uptime_spec.rb | 6 |
3 files changed, 15 insertions, 9 deletions
diff --git a/spec/functional/plugins/powershell_spec.rb b/spec/functional/plugins/powershell_spec.rb index a4fa4d4b..c7058078 100644 --- a/spec/functional/plugins/powershell_spec.rb +++ b/spec/functional/plugins/powershell_spec.rb @@ -22,52 +22,58 @@ describe Ohai::System, "languages plugin" do VERSION_MATCHING_REGEX = /^(?:[\d]+\.)+[\d]+$/.freeze describe "powershell plugin", :windows_only do RSpec.shared_examples "a version looking thing" do - it "should be present" do + it "is present" do expect(subject).not_to be_nil end - it "should look like a version" do + it "looks like a version" do expect(subject).to match(VERSION_MATCHING_REGEX) end end + subject { @plugin[:languages][:powershell] } + before(:all) do @plugin = get_plugin("powershell") @plugin[:languages] = Mash.new @plugin.run end - subject { @plugin[:languages][:powershell] } - - it "should have information about powershell" do + it "has information about powershell" do expect(subject).not_to be_nil end describe :version do subject { @plugin.languages[:powershell][described_class] } + it_behaves_like "a version looking thing" end describe :ws_man_stack_version do subject { @plugin.languages[:powershell][described_class] } + it_behaves_like "a version looking thing" end describe :serialization_version do subject { @plugin.languages[:powershell][described_class] } + it_behaves_like "a version looking thing" end describe :clr_version do subject { @plugin.languages[:powershell][described_class] } + it_behaves_like "a version looking thing" end describe :build_version do subject { @plugin.languages[:powershell][described_class] } + it_behaves_like "a version looking thing" end describe :remoting_protocol_version do subject { @plugin.languages[:powershell][described_class] } + it_behaves_like "a version looking thing" end diff --git a/spec/functional/plugins/root_group_spec.rb b/spec/functional/plugins/root_group_spec.rb index f52915a3..be0cb9dd 100644 --- a/spec/functional/plugins/root_group_spec.rb +++ b/spec/functional/plugins/root_group_spec.rb @@ -26,7 +26,7 @@ describe Ohai::System, "root_group plugin" do describe "windows platform", :windows_only do let(:wmi) { WmiLite::Wmi.new } - it "should return the system's administrators (root) group" do + it "returns the system's administrators (root) group" do # Notethat the Win32_Group WMI provider can be slow if your # system is domain-joined and has hundreds of thousands of # groups in Active Directory -- not a typical test scenario, but diff --git a/spec/functional/plugins/windows/uptime_spec.rb b/spec/functional/plugins/windows/uptime_spec.rb index c8ff75de..6b28caed 100644 --- a/spec/functional/plugins/windows/uptime_spec.rb +++ b/spec/functional/plugins/windows/uptime_spec.rb @@ -32,18 +32,18 @@ describe Ohai::System, "Windows plugin uptime" do }) end - before(:each) do + before do allow(uptime_plugin).to receive(:collect_os).and_return(:windows) allow(WmiLite::Wmi).to receive(:new).and_return(wmi) allow(Time).to receive_message_chain(:new, :to_i).and_return(1473756619) end - it "should set uptime_seconds to uptime" do + it "sets uptime_seconds to uptime" do uptime_plugin.run expect(uptime_plugin[:uptime_seconds]).to be == 80331 end - it "should set uptime to a human readable value" do + it "sets uptime to a human readable value" do uptime_plugin.run expect(uptime_plugin[:uptime]).to eq("22 hours 18 minutes 51 seconds") end |