summaryrefslogtreecommitdiff
path: root/spec/support/shared/unit/platform_introspector.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared/unit/platform_introspector.rb')
-rw-r--r--spec/support/shared/unit/platform_introspector.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/spec/support/shared/unit/platform_introspector.rb b/spec/support/shared/unit/platform_introspector.rb
index 30a2f61a70..e49667082f 100644
--- a/spec/support/shared/unit/platform_introspector.rb
+++ b/spec/support/shared/unit/platform_introspector.rb
@@ -17,7 +17,6 @@
# limitations under the License.
#
-
shared_examples_for "a platform introspector" do
before(:each) do
@platform_hash = {}
@@ -27,12 +26,12 @@ shared_examples_for "a platform introspector" do
"1.2.3" => "#{x}-1.2.3",
}
end
- @platform_hash["debian"] = {["5", "6"] => "debian-5/6", "default" => "debian"}
+ @platform_hash["debian"] = { ["5", "6"] => "debian-5/6", "default" => "debian" }
@platform_hash["default"] = "default"
# The following @platform_hash keys are used for testing version constraints
- @platform_hash["exact_match"] = { "1.2.3" => "exact", ">= 1.0" => "not exact"}
+ @platform_hash["exact_match"] = { "1.2.3" => "exact", ">= 1.0" => "not exact" }
@platform_hash["multiple_matches"] = { "~> 2.3.4" => "matched ~> 2.3.4", ">= 2.3" => "matched >=2.3" }
- @platform_hash["invalid_cookbook_version"] = {">= 21" => "Matches a single number"}
+ @platform_hash["invalid_cookbook_version"] = { ">= 21" => "Matches a single number" }
@platform_hash["successful_matches"] = { "< 3.0" => "matched < 3.0", ">= 3.0" => "matched >= 3.0" }
@platform_family_hash = {
@@ -93,7 +92,7 @@ shared_examples_for "a platform introspector" do
it "raises RuntimeError" do
node.automatic_attrs[:platform] = "multiple_matches"
node.automatic_attrs[:platform_version] = "2.3.4"
- expect {platform_introspector.value_for_platform(@platform_hash)}.to raise_error(RuntimeError)
+ expect { platform_introspector.value_for_platform(@platform_hash) }.to raise_error(RuntimeError)
end
it "should not require .0 to match >= 21.0" do
@@ -123,7 +122,6 @@ shared_examples_for "a platform introspector" do
end
describe "when checking platform?" do
-
it "returns true if the node is a provided platform and platforms are provided as symbols" do
node.automatic_attrs[:platform] = "ubuntu"
expect(platform_introspector.platform?([:redhat, :ubuntu])).to eq(true)
@@ -141,7 +139,6 @@ shared_examples_for "a platform introspector" do
end
describe "when checking platform_family?" do
-
it "returns true if the node is in a provided platform family and families are provided as symbols" do
node.automatic_attrs[:platform_family] = "debian"
expect(platform_introspector.platform_family?([:rhel, :debian])).to eq(true)
@@ -160,7 +157,6 @@ shared_examples_for "a platform introspector" do
it "returns false if the node is not of the provided platforms and platform_family is not set" do
expect(platform_introspector.platform_family?(:splatlinux)).to eq(false)
end
-
end
# NOTE: this is a regression test for bug CHEF-1514
describe "when the value is an array" do
@@ -171,7 +167,7 @@ shared_examples_for "a platform introspector" do
"centos" => { "default" => [ :restart, :reload, :status ] },
"redhat" => { "default" => [ :restart, :reload, :status ] },
"fedora" => { "default" => [ :restart, :reload, :status ] },
- "default" => { "default" => [:restart, :reload ] }}
+ "default" => { "default" => [:restart, :reload ] } }
end
it "returns the correct default for a given platform" do
@@ -186,6 +182,4 @@ shared_examples_for "a platform introspector" do
expect(platform_introspector.value_for_platform(@platform_hash)).to eq([:restart, :reload])
end
end
-
end
-