diff options
Diffstat (limited to 'spec/integration/recipes/recipe_dsl_spec.rb')
-rw-r--r-- | spec/integration/recipes/recipe_dsl_spec.rb | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb index 14cee0e1fd..f7a0e8b6e8 100644 --- a/spec/integration/recipes/recipe_dsl_spec.rb +++ b/spec/integration/recipes/recipe_dsl_spec.rb @@ -59,13 +59,30 @@ describe "Recipe DSL methods" do expect(BaseThingy.created_resource).to eq BaseThingy end - it "does not errors when you call base_thingy do ... end in a recipe" do - recipe = converge do + it "errors when you call base_thingy do ... end in a recipe" do + expect_converge do base_thingy { ; } + end.to raise_error(Chef::Exceptions::ValidationFailed) + end + + context "nameless resources" do + before(:context) do + class NamelessThingy < BaseThingy + resource_name :nameless_thingy + provides :nameless_thingy + + property :name, String, default: "" + end + end + + it "does not error when not given a name" do + recipe = converge do + nameless_thingy {} + end + expect(recipe.logged_warnings).to eq "" + expect(BaseThingy.created_name).to eq "" + expect(BaseThingy.created_resource).to eq NamelessThingy end - expect(recipe.logged_warnings).to eq "" - expect(BaseThingy.created_name).to eq "" - expect(BaseThingy.created_resource).to eq BaseThingy end context "Deprecated automatic resource DSL" do |