summaryrefslogtreecommitdiff
path: root/spec/integration/recipes/recipe_dsl_spec.rb
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-07-06 12:51:22 -0600
committerJohn Keiser <john@johnkeiser.com>2015-07-06 12:51:22 -0600
commitcb163f4b69e0378b9dc4c60b935b891e05706ccc (patch)
tree2281db33b9d5e2dc40d2f4f13512ca69882f8adf /spec/integration/recipes/recipe_dsl_spec.rb
parentc6d3fd81db9bab3bbd95e42c0d20d8218b6d8aa0 (diff)
downloadchef-cb163f4b69e0378b9dc4c60b935b891e05706ccc.tar.gz
Don't accept multiple parameters in recipe DSL (just name)
Diffstat (limited to 'spec/integration/recipes/recipe_dsl_spec.rb')
-rw-r--r--spec/integration/recipes/recipe_dsl_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb
index 4e80c5a738..1ab01fb20e 100644
--- a/spec/integration/recipes/recipe_dsl_spec.rb
+++ b/spec/integration/recipes/recipe_dsl_spec.rb
@@ -47,6 +47,26 @@ describe "Recipe DSL methods" do
BaseThingy.created_provider = nil
end
+ it "creates base_thingy when you call base_thingy in a recipe" do
+ recipe = converge {
+ base_thingy 'blah' do; end
+ }
+ expect(recipe.logged_warnings).to eq ''
+ expect(BaseThingy.created_resource).to eq BaseThingy
+ end
+
+ it "errors out when you call base_thingy do ... end in a recipe" do
+ expect_converge {
+ base_thingy do; end
+ }.to raise_error(ArgumentError, 'You must supply a name when declaring a base_thingy resource')
+ end
+
+ it "errors out when you call base_thingy 'foo', 'bar' do ... end in a recipe" do
+ expect_converge {
+ base_thingy 'foo', 'bar' do; end
+ }.to raise_error(ArgumentError, 'wrong number of arguments (2 for 0..1)')
+ end
+
context "Deprecated automatic resource DSL" do
before do
Chef::Config[:treat_deprecation_warnings_as_errors] = false