summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-09-14 15:44:43 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-09-14 15:44:43 -0700
commit3eb0d2292bdb54709b1f88bc9335b24d2269f0b8 (patch)
tree163ca27e71dd9062a0745221418c59873e325d1e /spec
parent3faabd74883c5f5d8b311478b86e37c120ebe4d1 (diff)
downloadchef-3eb0d2292bdb54709b1f88bc9335b24d2269f0b8.tar.gz
revert supports[:manage_home] behavior
even though i violently disagree that this is correct behavior and we're just going to break everyone in one massive go when we hit Chef 13. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/user/linux_spec.rb30
1 files changed, 24 insertions, 6 deletions
diff --git a/spec/unit/provider/user/linux_spec.rb b/spec/unit/provider/user/linux_spec.rb
index ac94592859..2470b26e2c 100644
--- a/spec/unit/provider/user/linux_spec.rb
+++ b/spec/unit/provider/user/linux_spec.rb
@@ -45,17 +45,35 @@ describe Chef::Provider::User::Linux do
@current_resource = Chef::Resource::User::LinuxUser.new("adam", @run_context)
end
- it "sets supports manage_home to true" do
- Chef::Config[:treat_deprecation_warnings_as_errors] = false
- expect( @new_resource.supports[:manage_home] ).to be true
+ it "supports manage_home does not exist", chef: ">= 13" do
+ expect( @new_resource.supports.key?(:manage_home) ).to be false
+ end
+
+ it "supports non_unique does not exist", chef: ">= 13" do
+ expect( @new_resource.supports.key?(:non_unique) ).to be false
+ end
+
+ # supports is a method on the superclass so can't totally be removed, but we should aggressively NOP it to decisively break it
+ it "disables the supports API", chef: ">= 13" do
+ @new_resource.supports( { manage_home: true } )
+ expect( @new_resource.supports.key?(:manage_home) ).to be false
+ end
+
+ it "sets supports manage_home to false" do
+ expect( @new_resource.supports[:manage_home] ).to be false
+ end
+
+ it "sets supports non-unique to false" do
+ expect( @new_resource.supports[:non_unique] ).to be false
end
- it "sets supports non-unique to true" do
+ it "throws a deprecation warning on setting supports[:manage_home]" do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
- expect( @new_resource.supports[:non_unique] ).to be true
+ expect(Chef).to receive(:log_deprecation).with("supports { manage_home: true } on the user resource is deprecated and will be removed in Chef 13, set manage_home: true instead")
+ @new_resource.supports( { :manage_home => true } )
end
- it "defaults manage_home to true" do
+ it "defaults manage_home to false" do
expect( @new_resource.manage_home ).to be false
end