summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormcquin <claire@chef.io>2016-04-14 10:11:17 -0700
committermcquin <claire@chef.io>2016-04-19 11:23:24 -0700
commitdedee0100659e1badbc962923cffbdc0512e93d2 (patch)
tree606297228bfca201729afbe4dbe839f1c1fa8872 /spec
parent1e7b6a07ee9cd0098d15e2f18606853ad207b65b (diff)
downloadohai-dedee0100659e1badbc962923cffbdc0512e93d2.tar.gz
Raise TypeError when intermediate key is not a HashOHAI-794/attribute-from-mash
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/dsl/plugin_spec.rb32
1 files changed, 18 insertions, 14 deletions
diff --git a/spec/unit/dsl/plugin_spec.rb b/spec/unit/dsl/plugin_spec.rb
index bd91eb30..4b225df5 100644
--- a/spec/unit/dsl/plugin_spec.rb
+++ b/spec/unit/dsl/plugin_spec.rb
@@ -169,11 +169,12 @@ shared_examples "Ohai::DSL::Plugin" do
end
describe "and an intermediate key is not a hash" do
- it "returns nil" do
- expect(
- plugin.get_attribute("the_moarch", "arch_rival",
+ it "raises a TypeError" do
+ expect {
+ plugin.get_attribute("the_monarch", "arch_rival",
"dr_venture", "since")
- ).to be nil
+ }.to raise_error(TypeError,
+ "Expected Hash but got String.")
end
end
end
@@ -202,11 +203,12 @@ shared_examples "Ohai::DSL::Plugin" do
end
describe "and an intermediate key is not a hash" do
- it "returns nil" do
- expect(
+ it "raises a TypeError" do
+ expect {
plugin.get_attribute(:the_monarch, :arch_rival,
:dr_venture, :since)
- ).to be nil
+ }.to raise_error(TypeError,
+ "Expected Hash but got String.")
end
end
end
@@ -274,11 +276,12 @@ shared_examples "Ohai::DSL::Plugin" do
end
describe "and an intermediate key is not a hash" do
- it "returns false" do
- expect(
- plugin.attribute?("the_moarch", "arch_rival",
+ it "raises a TypeError" do
+ expect {
+ plugin.attribute?("the_monarch", "arch_rival",
"dr_venture", "since")
- ).to be false
+ }.to raise_error(TypeError,
+ "Expected Hash but got String.")
end
end
end
@@ -306,11 +309,12 @@ shared_examples "Ohai::DSL::Plugin" do
end
describe "and an intermediate key is not a hash" do
- it "returns false" do
- expect(
+ it "raises a TypeError" do
+ expect {
plugin.attribute?(:the_monarch, :arch_rival,
:dr_venture, :since)
- ).to be false
+ }.to raise_error(TypeError,
+ "Expected Hash but got String.")
end
end
end