summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/data/lwrp/providers/buck_passer.rb2
-rw-r--r--spec/data/lwrp/providers/buck_passer_2.rb2
-rw-r--r--spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb2
-rw-r--r--spec/data/lwrp/providers/inline_compiler.rb2
-rw-r--r--spec/integration/recipes/lwrp_inline_resources_spec.rb18
-rw-r--r--spec/unit/lwrp_spec.rb2
-rw-r--r--spec/unit/provider_spec.rb7
7 files changed, 17 insertions, 18 deletions
diff --git a/spec/data/lwrp/providers/buck_passer.rb b/spec/data/lwrp/providers/buck_passer.rb
index 2bbca07bf7..0bbd413867 100644
--- a/spec/data/lwrp/providers/buck_passer.rb
+++ b/spec/data/lwrp/providers/buck_passer.rb
@@ -10,7 +10,7 @@ def without_deprecation_warnings(&block)
end
end
-action :pass_buck do
+def action_pass_buck
lwrp_foo :prepared_thumbs do
action :prepare_thumbs
# We know there will be a deprecation error here; head it off
diff --git a/spec/data/lwrp/providers/buck_passer_2.rb b/spec/data/lwrp/providers/buck_passer_2.rb
index c3bab7266f..980506c671 100644
--- a/spec/data/lwrp/providers/buck_passer_2.rb
+++ b/spec/data/lwrp/providers/buck_passer_2.rb
@@ -8,7 +8,7 @@ def without_deprecation_warnings(&block)
end
end
-action :pass_buck do
+def action_pass_buck
lwrp_bar :prepared_eyes do
action :prepare_eyes
# We know there will be a deprecation error here; head it off
diff --git a/spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb b/spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
index 77c1111ff5..d6996da55e 100644
--- a/spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
+++ b/spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
@@ -13,7 +13,7 @@ def without_deprecation_warnings(&block)
end
end
-action :twiddle_thumbs do
+def action_twiddle_thumbs
@enclosed_resource = lwrp_foo :foo do
monkey generate_new_name(new_resource.monkey){ 'the monkey' }
# We know there will be a deprecation error here; head it off
diff --git a/spec/data/lwrp/providers/inline_compiler.rb b/spec/data/lwrp/providers/inline_compiler.rb
index 2535276b24..91a80b32af 100644
--- a/spec/data/lwrp/providers/inline_compiler.rb
+++ b/spec/data/lwrp/providers/inline_compiler.rb
@@ -1,6 +1,4 @@
-use_inline_resources
-
action :test do
ruby_block "interior-ruby-block-1" do
diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb
index 65931d4764..54ce94f263 100644
--- a/spec/integration/recipes/lwrp_inline_resources_spec.rb
+++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb
@@ -19,14 +19,13 @@ describe "LWRPs with inline resources" do
let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
context "with a use_inline_resources provider with 'def action_a' instead of action :a" do
- class LwrpInlineResourcesTest < Chef::Resource::LWRPBase
+ class LwrpInlineResourcesTest < Chef::Resource
resource_name :lwrp_inline_resources_test
- actions :a, :nothing
+ allowed_actions :a, :nothing
default_action :a
property :ran_a
class Provider < Chef::Provider::LWRPBase
provides :lwrp_inline_resources_test
- use_inline_resources
def action_a
r = new_resource
ruby_block "run a" do
@@ -46,10 +45,10 @@ describe "LWRPs with inline resources" do
end
context "with an inline resource with a property that shadows the enclosing provider's property" do
- class LwrpShadowedPropertyTest < Chef::Resource::LWRPBase
+ class LwrpShadowedPropertyTest < Chef::Resource
PATH = ::File.join(Dir.tmpdir, "shadow-property.txt")
use_automatic_resource_name
- actions :fiddle
+ allowed_actions :fiddle
property :content
action :fiddle do
file PATH do
@@ -73,16 +72,14 @@ describe "LWRPs with inline resources" do
end
context "with an inline_resources provider with two actions, one calling the other" do
- class LwrpInlineResourcesTest2 < Chef::Resource::LWRPBase
+ class LwrpInlineResourcesTest2 < Chef::Resource
resource_name :lwrp_inline_resources_test2
- actions :a, :b, :nothing
+ allowed_actions :a, :b, :nothing
default_action :b
property :ran_a
property :ran_b
class Provider < Chef::Provider::LWRPBase
provides :lwrp_inline_resources_test2
- use_inline_resources
-
action :a do
r = new_resource
ruby_block "run a" do
@@ -133,8 +130,7 @@ describe "LWRPs with inline resources" do
default_action :create
EOM
file "providers/my_machine.rb", <<-EOM
- use_inline_resources
- action :create do
+ action :create do
x_do_nothing 'a'
x_do_nothing 'b'
end
diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb
index 353376aa77..75ebbb8f02 100644
--- a/spec/unit/lwrp_spec.rb
+++ b/spec/unit/lwrp_spec.rb
@@ -644,8 +644,6 @@ describe "LWRP" do
end
class MyAwesomeProvider < Chef::Provider::LWRPBase
- use_inline_resources
-
provides :my_awesome_resource
action :create do
diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb
index f252d3177d..6eb2bb9303 100644
--- a/spec/unit/provider_spec.rb
+++ b/spec/unit/provider_spec.rb
@@ -195,4 +195,11 @@ describe Chef::Provider do
end
end
+ context "when using use_inline_resources" do
+ it "should log a deprecation warning" do
+ pending Chef::VERSION.start_with?("13.6")
+ expect(Chef).to receive(:deprecated).with(:use_inline_resources, kind_of(String))
+ Class.new(described_class) { use_inline_resources }
+ end
+ end
end