summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/application_spec.rb10
-rw-r--r--spec/functional/loader_spec.rb4
-rw-r--r--spec/functional/plugins/powershell_spec.rb16
-rw-r--r--spec/functional/plugins/root_group_spec.rb2
-rw-r--r--spec/functional/plugins/windows/uptime_spec.rb6
5 files changed, 22 insertions, 16 deletions
diff --git a/spec/functional/application_spec.rb b/spec/functional/application_spec.rb
index b222e532..5370c92c 100644
--- a/spec/functional/application_spec.rb
+++ b/spec/functional/application_spec.rb
@@ -25,12 +25,12 @@ RSpec.describe "Ohai::Application" do
let(:argv) { [] }
let(:stderr) { StringIO.new }
- before(:each) do
+ before do
@original_argv = ARGV.dup
ARGV.replace(argv)
end
- after(:each) do
+ after do
ARGV.replace(@original_argv)
end
@@ -40,13 +40,13 @@ RSpec.describe "Ohai::Application" do
let(:config_dir) { Dir.mktmpdir(".chef") }
let(:config_location) { File.join(config_dir, "config.rb") }
- before(:each) do
+ before do
File.open(config_location, "w+") do |f|
f.write(config_content)
end
end
- after(:each) do
+ after do
FileUtils.rm_rf(config_dir)
end
@@ -74,7 +74,7 @@ RSpec.describe "Ohai::Application" do
# https://github.com/chef/chef/blob/master/chef-config/lib/chef-config/workstation_config_loader.rb#L102
let(:env) { { "KNIFE_HOME" => config_dir } }
- before(:each) do
+ before do
allow_any_instance_of(ChefConfig::WorkstationConfigLoader)
.to receive(:env).and_return(env)
end
diff --git a/spec/functional/loader_spec.rb b/spec/functional/loader_spec.rb
index f1eb2c2f..02ba673f 100644
--- a/spec/functional/loader_spec.rb
+++ b/spec/functional/loader_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe "Ohai::Loader" do
let(:plugin_directory) { Dir.mktmpdir("plugins") }
let(:plugin_path) { plugin_directory.tr("/", "\\") }
- before(:each) do
+ before do
Ohai.config[:plugin_path] = plugin_path
plugin_content = <<~EOF
@@ -38,7 +38,7 @@ RSpec.describe "Ohai::Loader" do
end
end
- after(:each) do
+ after do
FileUtils.rm_rf(plugin_directory)
end
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