summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-05-06 15:13:39 -0700
committerJohn Keiser <john@johnkeiser.com>2015-05-07 17:42:01 -0700
commit494b895d8d47e90f1d08cfd25aa79ce6b20a2cb7 (patch)
treea3cf5bd1a964a2e6655d9a0d1102a42c69bacece
parent120a00d4672bf7d618926819f7ad1fc9c1797b71 (diff)
downloadchef-494b895d8d47e90f1d08cfd25aa79ce6b20a2cb7.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 c0dbd087c0..ccd69311c9 100644
--- a/lib/chef/dsl/recipe.rb
+++ b/lib/chef/dsl/recipe.rb
@@ -63,6 +63,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 519b08bb6b..348905bd60 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 fe681f26ce..f04d3c41e8 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
}
@@ -156,18 +156,17 @@ describe "Recipe DSL methods" do
context "And Thingy4 provides :thingy3" do
before(:context) {
- class Foo::Thingy4 < Chef::Resource
+ class Foo::Thingy4 < BaseThingy
provides :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 Foo::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 bfd3034129..df5ca94b8a 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