summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-05-01 22:05:58 -0700
committerJohn Keiser <john@johnkeiser.com>2015-05-13 13:43:14 -0700
commitc17e5eda5f76e7abfbac904a0d5536ee6321cd61 (patch)
tree48710d222e14532804b62f14545fb1a96f116eb4 /spec
parentf25d2527b2ad8c45731ad5268fcd2a89e26f097d (diff)
downloadchef-c17e5eda5f76e7abfbac904a0d5536ee6321cd61.tar.gz
Add deprecation warning for providers that do not use provides
Diffstat (limited to 'spec')
-rw-r--r--spec/integration/recipes/provider_choice.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/integration/recipes/provider_choice.rb b/spec/integration/recipes/provider_choice.rb
new file mode 100644
index 0000000000..999765a1de
--- /dev/null
+++ b/spec/integration/recipes/provider_choice.rb
@@ -0,0 +1,41 @@
+require 'support/shared/integration/integration_helper'
+
+describe "Recipe DSL methods" do
+ include IntegrationSupport
+
+ context "With resource class providing 'provider_thingy'" do
+ before :context do
+ class Chef::Resource::ProviderThingy < Chef::Resource
+ def initialize(*args, &block)
+ super
+ @action = :create
+ @allowed_actions = [ :create ]
+ @resource_name = 'provider_thingy'
+ end
+ provides :provider_thingy
+ def to_s
+ "provider_thingy resource class"
+ end
+ end
+ end
+ context "And class Chef::Provider::ProviderThingy with no provides" do
+ before :context do
+ class Chef::Provider::ProviderThingy < Chef::Provider
+ def load_current_resource
+ end
+ def action_create
+ Chef::Log.warn("hello from #{self.class.name}")
+ end
+ end
+ end
+
+ it "provider_thingy 'blah' runs the provider and warns" do
+ recipe = converge {
+ provider_thingy 'blah' do; end
+ }
+ expect(recipe.logged_warnings).to match /hello from Chef::Provider::ProviderThingy/
+ expect(recipe.logged_warnings).to match /you must use 'provides' to provide DSL/i
+ end
+ end
+ end
+end