summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-05-06 15:13:39 -0700
committerJohn Keiser <john@johnkeiser.com>2015-06-02 09:53:39 -0700
commitea5c98fd538dd07d3dd98ab2cf01f6e99c0fe31c (patch)
tree50d876c05bcee132713c4d04b485f4c01a69db23
parent088772a1f8fe0203d20778166f3272074400df08 (diff)
downloadchef-ea5c98fd538dd07d3dd98ab2cf01f6e99c0fe31c.tar.gz
Make resource deprecation warnings once-only; fix recipe DSL tests back up
-rw-r--r--lib/chef/dsl/recipe.rb1
-rw-r--r--lib/chef/resource_resolver.rb1
-rw-r--r--spec/integration/recipes/recipe_dsl_spec.rb9
-rw-r--r--spec/unit/resource/template_spec.rb2
4 files changed, 6 insertions, 7 deletions
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb
index 0c9d200180..b97d1b6b70 100644
--- a/lib/chef/dsl/recipe.rb
+++ b/lib/chef/dsl/recipe.rb
@@ -65,6 +65,7 @@ class Chef
#
resource_class = Chef::ResourceResolver.new(run_context ? run_context.node : nil, method_symbol).resolve
if resource_class
+ Chef::DSL::Resources.add_resource_dsl(method_symbol)
return send(method_symbol, *args, &block)
end
diff --git a/lib/chef/resource_resolver.rb b/lib/chef/resource_resolver.rb
index da34f832eb..1bd8892239 100644
--- a/lib/chef/resource_resolver.rb
+++ b/lib/chef/resource_resolver.rb
@@ -18,7 +18,6 @@
require 'chef/exceptions'
require 'chef/platform/resource_priority_map'
-require 'chef/mixin/convert_to_class_name'
class Chef
class ResourceResolver
diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb
index 9d6b15a478..93270a9a19 100644
--- a/spec/integration/recipes/recipe_dsl_spec.rb
+++ b/spec/integration/recipes/recipe_dsl_spec.rb
@@ -70,7 +70,7 @@ describe "Recipe DSL methods" do
}
- it "backcompat_thingy creates a Chef::Resource::BackcompatThingy", :focus do
+ it "backcompat_thingy creates a Chef::Resource::BackcompatThingy" do
recipe = converge {
backcompat_thingy 'blah' do; end
}
@@ -157,18 +157,17 @@ describe "Recipe DSL methods" do
context "And Thingy4 provides :thingy3" do
before(:context) {
- class RecipeDSLSpecNamespace::Thingy4 < Chef::Resource
+ class RecipeDSLSpecNamespace::Thingy4 < BaseThingy
resource_name :thingy3
end
}
- it "thingy3 works in a recipe and yields " do
+ it "thingy3 works in a recipe and yields Foo::Thingy4 (the explicit one)" do
recipe = converge {
thingy3 'blah' do; end
}
- expect(recipe.logged_warnings).to match(/ambiguous resource precedence/i)
- expect(BaseThingy.created_resource).not_to be_nil
+ expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy4
end
it "thingy4 does not work in a recipe" do
diff --git a/spec/unit/resource/template_spec.rb b/spec/unit/resource/template_spec.rb
index 9a2c4fe30b..2fd951b72d 100644
--- a/spec/unit/resource/template_spec.rb
+++ b/spec/unit/resource/template_spec.rb
@@ -183,7 +183,7 @@ describe Chef::Resource::Template do
expect { @resource.helpers(ExampleHelpers) { module_code } }.to raise_error(Chef::Exceptions::ValidationFailed)
end
- it "collects helper modules", :focus do
+ it "collects helper modules" do
@resource.helpers(ExampleHelpers)
expect(@resource.helper_modules).to include(ExampleHelpers)
end