summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-03-06 10:38:39 -0800
committerTim Smith <tsmith@chef.io>2018-03-06 10:38:39 -0800
commit011db28d6c3026ac41b9c519a87643d70ecf9be5 (patch)
tree636e072786c5aa143ce3cd964da1548f5b1ea818 /spec/unit
parentdfa786b965a649349ef77def4c22af454c33ccb0 (diff)
downloadohai-011db28d6c3026ac41b9c519a87643d70ecf9be5.tar.gz
Resolve the last of the chefstyle warningsgreen_travis
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/dsl/plugin_spec.rb8
-rw-r--r--spec/unit/mixin/azure_metadata_spec.rb2
-rw-r--r--spec/unit/plugins/darwin/filesystem_spec.rb2
-rw-r--r--spec/unit/plugins/darwin/hardware_spec.rb2
-rw-r--r--spec/unit/plugins/haskell_spec.rb2
-rw-r--r--spec/unit/plugins/linux/filesystem_spec.rb2
-rw-r--r--spec/unit/plugins/linux/lspci_spec.rb2
-rw-r--r--spec/unit/plugins/network_spec.rb22
-rw-r--r--spec/unit/plugins/rust_spec.rb2
-rw-r--r--spec/unit/plugins/scala_spec.rb2
-rw-r--r--spec/unit/plugins/solaris2/cpu_spec.rb6
-rw-r--r--spec/unit/runner_spec.rb6
12 files changed, 28 insertions, 30 deletions
diff --git a/spec/unit/dsl/plugin_spec.rb b/spec/unit/dsl/plugin_spec.rb
index 5000b112..c0ee6cf5 100644
--- a/spec/unit/dsl/plugin_spec.rb
+++ b/spec/unit/dsl/plugin_spec.rb
@@ -435,13 +435,13 @@ describe Ohai::DSL::Plugin::VersionVII do
end
it "collects attributes across multiple plugin files" do
- plugin = Ohai.plugin(:Test) { provides("one") }
+ plugin = Ohai.plugin(:Test) { provides("one") } # rubocop: disable Lint/UselessAssignment
plugin = Ohai.plugin(:Test) { provides("two", "three") }
expect(plugin.provides_attrs).to eql(%w{one two three})
end
it "collects unique attributes" do
- plugin = Ohai.plugin(:Test) { provides("one") }
+ plugin = Ohai.plugin(:Test) { provides("one") } # rubocop: disable Lint/UselessAssignment
plugin = Ohai.plugin(:Test) { provides("one", "two") }
expect(plugin.provides_attrs).to eql(%w{one two})
end
@@ -468,13 +468,13 @@ describe Ohai::DSL::Plugin::VersionVII do
end
it "collects dependencies across multiple plugin files" do
- plugin = Ohai.plugin(:Test) { depends("one") }
+ plugin = Ohai.plugin(:Test) { depends("one") } # rubocop: disable Lint/UselessAssignment
plugin = Ohai.plugin(:Test) { depends("two", "three") }
expect(plugin.depends_attrs).to eql(%w{one two three})
end
it "collects unique attributes" do
- plugin = Ohai.plugin(:Test) { depends("one") }
+ plugin = Ohai.plugin(:Test) { depends("one") } # rubocop: disable Lint/UselessAssignment
plugin = Ohai.plugin(:Test) { depends("one", "two") }
expect(plugin.depends_attrs).to eql(%w{one two})
end
diff --git a/spec/unit/mixin/azure_metadata_spec.rb b/spec/unit/mixin/azure_metadata_spec.rb
index e7414120..8d0f9443 100644
--- a/spec/unit/mixin/azure_metadata_spec.rb
+++ b/spec/unit/mixin/azure_metadata_spec.rb
@@ -31,7 +31,7 @@ describe Ohai::Mixin::AzureMetadata do
allow(http_mock).to receive(:read_timeout=)
allow(Net::HTTP).to receive(:start).with("169.254.169.254").and_return(http_mock)
- expect(http_mock).to receive(:get).with("http://www.chef.io", initheader = { "Metadata" => "true" })
+ expect(http_mock).to receive(:get).with("http://www.chef.io", { "Metadata" => "true" })
mixin.http_get("http://www.chef.io")
end
end
diff --git a/spec/unit/plugins/darwin/filesystem_spec.rb b/spec/unit/plugins/darwin/filesystem_spec.rb
index 87b0f620..63889dc0 100644
--- a/spec/unit/plugins/darwin/filesystem_spec.rb
+++ b/spec/unit/plugins/darwin/filesystem_spec.rb
@@ -19,7 +19,7 @@
require_relative "../../../spec_helper.rb"
describe Ohai::System, "darwin filesystem plugin" do
- let (:plugin) { get_plugin("darwin/filesystem") }
+ let(:plugin) { get_plugin("darwin/filesystem") }
before(:each) do
allow(plugin).to receive(:collect_os).and_return(:darwin)
diff --git a/spec/unit/plugins/darwin/hardware_spec.rb b/spec/unit/plugins/darwin/hardware_spec.rb
index f8c8e1d5..5c456f19 100644
--- a/spec/unit/plugins/darwin/hardware_spec.rb
+++ b/spec/unit/plugins/darwin/hardware_spec.rb
@@ -20,7 +20,7 @@ require_relative "../../../spec_helper.rb"
require_relative "hardware_system_profiler_output.rb"
describe Ohai::System, "Darwin hardware plugin", :unix_only do
- let (:plugin) { get_plugin("darwin/hardware") }
+ let(:plugin) { get_plugin("darwin/hardware") }
before(:each) do
allow(plugin).to receive(:collect_os).and_return(:darwin)
# Make sure it always runs correct commands and mock the data as it calls them
diff --git a/spec/unit/plugins/haskell_spec.rb b/spec/unit/plugins/haskell_spec.rb
index a20b125e..e68aaf76 100644
--- a/spec/unit/plugins/haskell_spec.rb
+++ b/spec/unit/plugins/haskell_spec.rb
@@ -19,7 +19,7 @@ require_relative "../../spec_helper.rb"
describe Ohai::System, "plugin haskell" do
let(:plugin) do
- plugin = get_plugin("haskell").tap do |plugin|
+ get_plugin("haskell").tap do |plugin|
plugin[:languages] = Mash.new
end
end
diff --git a/spec/unit/plugins/linux/filesystem_spec.rb b/spec/unit/plugins/linux/filesystem_spec.rb
index 3f9b4336..6b29bd7d 100644
--- a/spec/unit/plugins/linux/filesystem_spec.rb
+++ b/spec/unit/plugins/linux/filesystem_spec.rb
@@ -19,7 +19,7 @@
require_relative "../../../spec_helper.rb"
describe Ohai::System, "Linux filesystem plugin" do
- let (:plugin) { get_plugin("linux/filesystem") }
+ let(:plugin) { get_plugin("linux/filesystem") }
before(:each) do
allow(plugin).to receive(:collect_os).and_return(:linux)
diff --git a/spec/unit/plugins/linux/lspci_spec.rb b/spec/unit/plugins/linux/lspci_spec.rb
index 074068bb..9948e2f8 100644
--- a/spec/unit/plugins/linux/lspci_spec.rb
+++ b/spec/unit/plugins/linux/lspci_spec.rb
@@ -19,7 +19,7 @@
require_relative "../../../spec_helper.rb"
describe Ohai::System, "Linux lspci plugin" do
- let (:plugin) { get_plugin("linux/lspci") }
+ let(:plugin) { get_plugin("linux/lspci") }
before(:each) do
allow(plugin).to receive(:collect_os).and_return(:linux)
@stdout = <<LSPCI
diff --git a/spec/unit/plugins/network_spec.rb b/spec/unit/plugins/network_spec.rb
index 99c1ec34..e14839fb 100644
--- a/spec/unit/plugins/network_spec.rb
+++ b/spec/unit/plugins/network_spec.rb
@@ -475,8 +475,8 @@ describe Ohai::System, "Network Plugin" do
@plugin["network"]["default_interface"] = nil
@plugin["network"]["default_inet6_gateway"] = nil
@plugin["network"]["default_inet6_interface"] = nil
- @plugin["network"]["interfaces"].each do |i, iv|
- iv["addresses"].delete_if { |k, kv| %w{inet inet6}.include? kv["family"] }
+ @plugin["network"]["interfaces"].each_value do |val|
+ val["addresses"].delete_if { |k, kv| %w{inet inet6}.include? kv["family"] }
end
end
@@ -660,7 +660,7 @@ describe Ohai::System, "Network Plugin" do
@plugin["network"]["default_inet6_gateway"] = nil
@plugin["network"]["default_inet6_interface"] = nil
# just changing scopes to lInK for eth0 addresses
- @plugin["network"]["interfaces"]["eth0"]["addresses"].each { |k, v| v[:scope] = "lInK" if %w{inet inet6}.include? v["family"] }
+ @plugin["network"]["interfaces"]["eth0"]["addresses"].each_value { |v| v[:scope] = "lInK" if %w{inet inet6}.include? v["family"] }
end
it_populates_ipaddress_attributes
@@ -781,8 +781,8 @@ describe Ohai::System, "Network Plugin" do
before do
@plugin["network"]["default_gateway"] = nil
@plugin["network"]["default_interface"] = nil
- @plugin["network"]["interfaces"].each do |i, iv|
- iv["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
+ @plugin["network"]["interfaces"].each_value do |val|
+ val["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
end
end
@@ -928,9 +928,9 @@ describe Ohai::System, "Network Plugin" do
before do
@plugin["network"]["default_gateway"] = nil
@plugin["network"]["default_interface"] = nil
- @plugin["network"]["interfaces"].each do |i, iv|
- if iv.has_key? "addresses"
- iv["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
+ @plugin["network"]["interfaces"].each_value do |val|
+ if val.has_key? "addresses"
+ val["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
end
end
@plugin["ip6address"] = "3ffe:8888:9999::1"
@@ -1013,9 +1013,9 @@ describe Ohai::System, "Network Plugin" do
before do
@plugin["network"]["default_gateway"] = nil
@plugin["network"]["default_interface"] = nil
- @plugin["network"]["interfaces"].each do |i, iv|
- if iv.has_key? "addresses"
- iv["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
+ @plugin["network"]["interfaces"].each_value do |val|
+ if val.has_key? "addresses"
+ val["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
end
end
@plugin["macaddress"] = "00:AA:BB:CC:DD:EE"
diff --git a/spec/unit/plugins/rust_spec.rb b/spec/unit/plugins/rust_spec.rb
index e8ffdc6e..8046d0ee 100644
--- a/spec/unit/plugins/rust_spec.rb
+++ b/spec/unit/plugins/rust_spec.rb
@@ -18,7 +18,7 @@ require_relative "../../spec_helper.rb"
describe Ohai::System, "plugin rust" do
let(:stdout) { "rustc 1.0.0-nightly (29bd9a06e 2015-01-20 23:03:09 +0000)" }
- let (:plugin) do
+ let(:plugin) do
plugin = get_plugin("rust")
plugin[:languages] = Mash.new
allow(plugin).to receive(:shell_out).with("rustc --version").and_return(mock_shell_out(0, stdout, ""))
diff --git a/spec/unit/plugins/scala_spec.rb b/spec/unit/plugins/scala_spec.rb
index 18e8de69..76656c98 100644
--- a/spec/unit/plugins/scala_spec.rb
+++ b/spec/unit/plugins/scala_spec.rb
@@ -20,7 +20,7 @@ require_relative "../../spec_helper.rb"
describe Ohai::System, "plugin scala" do
let(:plugin) do
- plugin = get_plugin("scala").tap do |plugin|
+ get_plugin("scala").tap do |plugin|
plugin[:languages] = Mash.new
end
end
diff --git a/spec/unit/plugins/solaris2/cpu_spec.rb b/spec/unit/plugins/solaris2/cpu_spec.rb
index 86b6b028..c6991f0d 100644
--- a/spec/unit/plugins/solaris2/cpu_spec.rb
+++ b/spec/unit/plugins/solaris2/cpu_spec.rb
@@ -455,15 +455,15 @@ END
end
it "should get the number of threads per core" do
- expect(@plugin["cpu"]["corethreads"]).to eql (2)
+ expect(@plugin["cpu"]["corethreads"]).to eql(2)
end
it "should get the total number of online cores" do
- expect(@plugin["cpu"]["cpustates"]["on-line"]).to eql (8)
+ expect(@plugin["cpu"]["cpustates"]["on-line"]).to eql(8)
end
it "should get the total number of offline cores" do
- expect(@plugin["cpu"]["cpustates"]["off-line"]).to eql (8)
+ expect(@plugin["cpu"]["cpustates"]["off-line"]).to eql(8)
end
describe "per-cpu information" do
diff --git a/spec/unit/runner_spec.rb b/spec/unit/runner_spec.rb
index 64baf51c..5e079c10 100644
--- a/spec/unit/runner_spec.rb
+++ b/spec/unit/runner_spec.rb
@@ -224,7 +224,7 @@ describe Ohai::Runner, "run_plugin" do
context "when there are no edges in the cycle (A->A)" do
let(:plugin_class) do
- klass1 = Ohai.plugin(:Thing) do
+ Ohai.plugin(:Thing) do
provides("thing")
depends("thing")
collect_data do
@@ -236,8 +236,6 @@ describe Ohai::Runner, "run_plugin" do
it "ignores the cycle" do
@ohai.provides_map.set_providers_for(plugin, ["thing"])
-
- expected_error_string = "Dependency cycle detected. Please refer to the following plugins: Thing, Other"
runner.run_plugin(plugin) # should not raise
end
@@ -245,7 +243,7 @@ describe Ohai::Runner, "run_plugin" do
context "when there is one edge in the cycle (A->B and B->A)" do
before(:each) do
- klass1 = Ohai.plugin(:Thing) do
+ klass1 = Ohai.plugin(:Thing) do # rubocop disable Lint/UselessAssignment
provides("thing")
depends("other")
collect_data do