From 16dbca593b2fef74d952c5e119313efbe2288670 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Wed, 27 May 2015 18:01:47 -0700 Subject: Toss an error if a resource without a resource_name is created --- .../integration/recipes/resource_definition_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spec/integration/recipes/resource_definition_spec.rb (limited to 'spec/integration') diff --git a/spec/integration/recipes/resource_definition_spec.rb b/spec/integration/recipes/resource_definition_spec.rb new file mode 100644 index 0000000000..da92bb18fa --- /dev/null +++ b/spec/integration/recipes/resource_definition_spec.rb @@ -0,0 +1,21 @@ +require 'support/shared/integration/integration_helper' + +describe "Resource definition" do + include IntegrationSupport + + context "With a resource with no resource_name or provides line" do + before do + Chef::Config[:treat_deprecation_warnings_as_errors] = false + end + + before(:context) { + class Chef::Resource::ResourceDefinitionNoNameTest < Chef::Resource + end + } + it "Creating said resource with the resource builder fails with an exception" do + expect_converge { + resource_definition_no_name_test 'blah' + }.to raise_error(Chef::Exceptions::InvalidResourceSpecification) + end + end +end -- cgit v1.2.1