chef 14.1.12 → 14.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -6
  3. data/VERSION +1 -1
  4. data/chef.gemspec +2 -3
  5. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +8 -4
  6. data/lib/chef/cookbook/manifest_v0.rb +2 -2
  7. data/lib/chef/cookbook_manifest.rb +3 -2
  8. data/lib/chef/cookbook_version.rb +3 -2
  9. data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -2
  10. data/lib/chef/http/auth_credentials.rb +5 -3
  11. data/lib/chef/http/authenticator.rb +6 -3
  12. data/lib/chef/knife.rb +3 -6
  13. data/lib/chef/knife/configure.rb +12 -8
  14. data/lib/chef/knife/raw.rb +6 -1
  15. data/lib/chef/mixin/shell_out.rb +16 -14
  16. data/lib/chef/provider/execute.rb +4 -3
  17. data/lib/chef/provider/git.rb +1 -1
  18. data/lib/chef/provider/package/dnf.rb +5 -5
  19. data/lib/chef/provider/package/windows.rb +7 -0
  20. data/lib/chef/provider/package/yum.rb +7 -7
  21. data/lib/chef/provider/service/freebsd.rb +3 -3
  22. data/lib/chef/provider/service/init.rb +5 -5
  23. data/lib/chef/provider/service/macosx.rb +5 -4
  24. data/lib/chef/provider/service/simple.rb +4 -4
  25. data/lib/chef/provider/service/systemd.rb +13 -13
  26. data/lib/chef/provider/service/upstart.rb +3 -3
  27. data/lib/chef/provider/service/windows.rb +2 -0
  28. data/lib/chef/provider/systemd_unit.rb +4 -4
  29. data/lib/chef/provider/user.rb +18 -1
  30. data/lib/chef/provider/user/aix.rb +40 -8
  31. data/lib/chef/provider/user/dscl.rb +7 -14
  32. data/lib/chef/provider/user/linux.rb +1 -11
  33. data/lib/chef/provider/user/solaris.rb +57 -26
  34. data/lib/chef/provider/user/useradd.rb +4 -1
  35. data/lib/chef/provider/windows_task.rb +1 -0
  36. data/lib/chef/providers.rb +1 -2
  37. data/lib/chef/resource/execute.rb +4 -1
  38. data/lib/chef/resource/gem_package.rb +1 -1
  39. data/lib/chef/resource/hostname.rb +1 -1
  40. data/lib/chef/resource/sysctl.rb +3 -1
  41. data/lib/chef/resource/windows_ad_join.rb +16 -3
  42. data/lib/chef/resource_inspector.rb +13 -0
  43. data/lib/chef/run_context/cookbook_compiler.rb +1 -1
  44. data/lib/chef/server_api.rb +2 -0
  45. data/lib/chef/version.rb +1 -1
  46. data/spec/functional/mixin/shell_out_spec.rb +27 -1
  47. data/spec/functional/resource/execute_spec.rb +2 -2
  48. data/spec/functional/resource/windows_task_spec.rb +1 -1
  49. data/spec/support/shared/functional/securable_resource.rb +1 -1
  50. data/spec/support/shared/unit/execute_resource.rb +1 -1
  51. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +3 -3
  52. data/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +65 -0
  53. data/spec/unit/cookbook/manifest_v0_spec.rb +1 -1
  54. data/spec/unit/cookbook_manifest_spec.rb +2 -0
  55. data/spec/unit/dsl/recipe_spec.rb +1 -5
  56. data/spec/unit/http/authenticator_spec.rb +33 -8
  57. data/spec/unit/mixin/shell_out_spec.rb +61 -1
  58. data/spec/unit/provider/apt_update_spec.rb +7 -7
  59. data/spec/unit/provider/execute_spec.rb +16 -15
  60. data/spec/unit/provider/git_spec.rb +3 -3
  61. data/spec/unit/provider/package/windows_spec.rb +12 -0
  62. data/spec/unit/provider/script_spec.rb +2 -2
  63. data/spec/unit/provider/service/arch_service_spec.rb +9 -9
  64. data/spec/unit/provider/service/freebsd_service_spec.rb +6 -6
  65. data/spec/unit/provider/service/init_service_spec.rb +11 -11
  66. data/spec/unit/provider/service/invokercd_service_spec.rb +9 -9
  67. data/spec/unit/provider/service/macosx_spec.rb +11 -11
  68. data/spec/unit/provider/service/openbsd_service_spec.rb +6 -6
  69. data/spec/unit/provider/service/simple_service_spec.rb +4 -4
  70. data/spec/unit/provider/service/systemd_service_spec.rb +16 -16
  71. data/spec/unit/provider/service/upstart_service_spec.rb +12 -12
  72. data/spec/unit/provider/service/windows_spec.rb +5 -0
  73. data/spec/unit/provider/systemd_unit_spec.rb +163 -118
  74. data/spec/unit/provider/user/dscl_spec.rb +2 -9
  75. data/spec/unit/provider/user/solaris_spec.rb +2 -2
  76. data/spec/unit/provider/zypper_repository_spec.rb +3 -3
  77. data/spec/unit/provider_spec.rb +1 -5
  78. data/spec/unit/resource/apt_package_spec.rb +14 -0
  79. data/spec/unit/resource/apt_preference_spec.rb +14 -1
  80. data/spec/unit/resource/apt_repository_spec.rb +12 -3
  81. data/spec/unit/resource/apt_update_spec.rb +9 -0
  82. data/spec/unit/resource/bash_spec.rb +8 -0
  83. data/spec/unit/resource/bff_package_spec.rb +51 -0
  84. data/spec/unit/resource/breakpoint_spec.rb +4 -4
  85. data/spec/unit/resource/build_essential_spec.rb +5 -1
  86. data/spec/unit/resource/cab_package_spec.rb +10 -0
  87. data/spec/unit/resource/chef_gem_spec.rb +14 -0
  88. data/spec/unit/resource/chef_handler_spec.rb +9 -4
  89. data/spec/unit/resource/chocolatey_package_spec.rb +15 -1
  90. data/spec/unit/resource/conditional_spec.rb +3 -3
  91. data/spec/unit/resource/cookbook_file_spec.rb +13 -2
  92. data/spec/unit/resource/cron_spec.rb +2 -7
  93. data/spec/unit/resource/csh_spec.rb +8 -0
  94. data/spec/unit/resource/directory_spec.rb +4 -9
  95. data/spec/unit/resource/dmg_package_spec.rb +8 -4
  96. data/spec/unit/resource/dnf_package_spec.rb +16 -1
  97. data/spec/unit/resource/dpkg_package_spec.rb +18 -0
  98. data/spec/unit/resource/dsc_resource_spec.rb +6 -6
  99. data/spec/unit/resource/dsc_script_spec.rb +39 -39
  100. data/spec/unit/resource/execute_spec.rb +20 -12
  101. data/spec/unit/resource/file_spec.rb +10 -10
  102. data/spec/unit/resource/freebsd_package_spec.rb +16 -0
  103. data/spec/unit/resource/gem_package_spec.rb +27 -0
  104. data/spec/unit/resource/git_spec.rb +17 -2
  105. data/spec/unit/resource/group_spec.rb +18 -17
  106. data/spec/unit/resource/homebrew_cask_spec.rb +9 -4
  107. data/spec/unit/resource/homebrew_package_spec.rb +14 -0
  108. data/spec/unit/resource/homebrew_tap_spec.rb +8 -3
  109. data/spec/unit/resource/hostname_spec.rb +10 -6
  110. data/spec/unit/resource/http_request_spec.rb +14 -0
  111. data/spec/unit/resource/ips_package_spec.rb +15 -3
  112. data/spec/unit/resource/ksh_spec.rb +8 -0
  113. data/spec/unit/resource/launchd_spec.rb +11 -5
  114. data/spec/unit/resource/link_spec.rb +6 -11
  115. data/spec/unit/resource/log_spec.rb +8 -8
  116. data/spec/unit/resource/macos_user_defaults_spec.rb +5 -1
  117. data/spec/unit/resource/macports_package_spec.rb +19 -0
  118. data/spec/unit/resource/mdadm_spec.rb +7 -3
  119. data/spec/unit/resource/mount_spec.rb +15 -18
  120. data/spec/unit/resource/msu_package_spec.rb +10 -0
  121. data/spec/unit/resource/ohai_hint_spec.rb +9 -8
  122. data/spec/unit/resource/ohai_spec.rb +11 -3
  123. data/spec/unit/resource/openbsd_package_spec.rb +14 -0
  124. data/spec/unit/resource/openssl_dhparam.rb +10 -5
  125. data/spec/unit/resource/openssl_rsa_private_key_spec.rb +10 -5
  126. data/spec/unit/resource/openssl_rsa_public_key_spec.rb +9 -5
  127. data/spec/unit/resource/osx_profile_spec.rb +7 -4
  128. data/spec/unit/resource/package_spec.rb +14 -0
  129. data/spec/unit/resource/pacman_package_spec.rb +17 -3
  130. data/spec/unit/resource/paludis_package_spec.rb +36 -0
  131. data/spec/unit/resource/perl_spec.rb +8 -0
  132. data/spec/unit/resource/portage_package_spec.rb +14 -0
  133. data/spec/unit/resource/powershell_package_spec.rb +14 -0
  134. data/spec/unit/resource/python_spec.rb +8 -0
  135. data/spec/unit/resource/reboot_spec.rb +5 -3
  136. data/spec/unit/resource/registry_key_spec.rb +12 -1
  137. data/spec/unit/resource/remote_directory_spec.rb +11 -1
  138. data/spec/unit/resource/remote_file_spec.rb +19 -0
  139. data/spec/unit/resource/rhsm_errata_level_spec.rb +7 -3
  140. data/spec/unit/resource/rhsm_errata_spec.rb +8 -4
  141. data/spec/unit/resource/rhsm_register_spec.rb +6 -1
  142. data/spec/unit/resource/rhsm_repo_spec.rb +9 -4
  143. data/spec/unit/resource/rhsm_subscription_spec.rb +9 -4
  144. data/spec/unit/resource/route_spec.rb +4 -9
  145. data/spec/unit/resource/rpm_package_spec.rb +14 -0
  146. data/spec/unit/resource/ruby_block_spec.rb +12 -8
  147. data/spec/unit/resource/ruby_spec.rb +8 -0
  148. data/spec/unit/resource/scm_spec.rb +16 -8
  149. data/spec/unit/resource/script_spec.rb +8 -0
  150. data/spec/unit/resource/service_spec.rb +15 -0
  151. data/spec/unit/resource/smartos_package_spec.rb +18 -4
  152. data/spec/unit/resource/solaris_package_spec.rb +14 -0
  153. data/spec/unit/resource/subversion_spec.rb +14 -8
  154. data/spec/unit/resource/sudo_spec.rb +11 -4
  155. data/spec/unit/resource/swap_file_spec.rb +4 -5
  156. data/spec/unit/resource/sysctl_spec.rb +8 -10
  157. data/spec/unit/resource/systemd_unit_spec.rb +14 -12
  158. data/spec/unit/resource/template_spec.rb +19 -0
  159. data/spec/unit/resource/{windows_ad_join.rb → windows_ad_join_spec.rb} +12 -6
  160. data/spec/unit/resource/windows_auto_run_spec.rb +9 -9
  161. data/spec/unit/resource/windows_env_spec.rb +8 -16
  162. data/spec/unit/resource/windows_feature.rb +27 -8
  163. data/spec/unit/resource/windows_feature_dism.rb +30 -9
  164. data/spec/unit/resource/windows_feature_powershell.rb +7 -7
  165. data/spec/unit/resource/windows_font_spec.rb +3 -4
  166. data/spec/unit/resource/windows_package_spec.rb +12 -2
  167. data/spec/unit/resource/windows_pagefile_spec.rb +12 -8
  168. data/spec/unit/resource/windows_path_spec.rb +4 -5
  169. data/spec/unit/resource/windows_printer_port_spec.rb +20 -3
  170. data/spec/unit/resource/windows_printer_spec.rb +12 -5
  171. data/spec/unit/resource/windows_service_spec.rb +24 -1
  172. data/spec/unit/resource/windows_shortcut_spec.rb +4 -5
  173. data/spec/unit/resource/yum_repository_spec.rb +48 -2
  174. data/spec/unit/resource/zypper_package_spec.rb +51 -0
  175. data/spec/unit/resource/zypper_repository_spec.rb +56 -11
  176. data/spec/unit/resource_spec.rb +1 -5
  177. metadata +21 -12
  178. data/spec/functional/resource/user/useradd_spec.rb +0 -709
@@ -27,13 +27,17 @@ describe Chef::Resource::Mdadm do
27
27
  expect(resource.resource_name).to eql(:mdadm)
28
28
  end
29
29
 
30
- it "has a default action of create" do
30
+ it "the raid_device property is the name_property" do
31
+ expect(resource.raid_device).to eql("fakey_fakerton")
32
+ end
33
+
34
+ it "sets the default action as :create" do
31
35
  expect(resource.action).to eql([:create])
32
36
  end
33
37
 
34
- it "accepts create, assemble, stop as actions" do
35
- expect { resource.action :create }.not_to raise_error
38
+ it "supports :assemble, :create, :stop actions" do
36
39
  expect { resource.action :assemble }.not_to raise_error
40
+ expect { resource.action :create }.not_to raise_error
37
41
  expect { resource.action :stop }.not_to raise_error
38
42
  end
39
43
 
@@ -20,29 +20,26 @@
20
20
  require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::Mount do
23
- let(:resource) { Chef::Resource::Mount.new("filesystem") }
23
+ let(:resource) { Chef::Resource::Mount.new("fakey_fakerton") }
24
24
 
25
- it "has a name property" do
26
- expect(resource.name).to eql("filesystem")
25
+ it "the mount_point property is the name_property" do
26
+ expect(resource.mount_point).to eql("fakey_fakerton")
27
27
  end
28
28
 
29
- it "sets mount_point to the name" do
30
- expect(resource.mount_point).to eql("filesystem")
31
- end
32
-
33
- it "has a default action of mount" do
29
+ it "sets the default action as :mount" do
34
30
  expect(resource.action).to eql([:mount])
35
31
  end
36
32
 
37
- it "accepts mount, umount, unmount and remount as actions" do
33
+ it "supports :disable, :enable, :mount, :remount, :umount, :unmount actions" do
34
+ expect { resource.action :disable }.not_to raise_error
35
+ expect { resource.action :enable }.not_to raise_error
38
36
  expect { resource.action :mount }.not_to raise_error
37
+ expect { resource.action :remount }.not_to raise_error
39
38
  expect { resource.action :umount }.not_to raise_error
40
39
  expect { resource.action :unmount }.not_to raise_error
41
- expect { resource.action :remount }.not_to raise_error
42
- expect { resource.action :brooklyn }.to raise_error(ArgumentError)
43
40
  end
44
41
 
45
- it "allows you to set the device attribute" do
42
+ it "allows you to set the device property" do
46
43
  resource.device "/dev/sdb3"
47
44
  expect(resource.device).to eql("/dev/sdb3")
48
45
  end
@@ -51,12 +48,12 @@ describe Chef::Resource::Mount do
51
48
  expect(resource.fsck_device).to eql("-")
52
49
  end
53
50
 
54
- it "allows you to set the fsck_device attribute" do
51
+ it "allows you to set the fsck_device property" do
55
52
  resource.fsck_device "/dev/rdsk/sdb3"
56
53
  expect(resource.fsck_device).to eql("/dev/rdsk/sdb3")
57
54
  end
58
55
 
59
- it "allows you to set the fstype attribute" do
56
+ it "allows you to set the fstype property" do
60
57
  resource.fstype "nfs"
61
58
  expect(resource.fstype).to eql("nfs")
62
59
  end
@@ -65,17 +62,17 @@ describe Chef::Resource::Mount do
65
62
  expect(resource.fstype).to eql("auto")
66
63
  end
67
64
 
68
- it "allows you to set the dump attribute" do
65
+ it "allows you to set the dump property" do
69
66
  resource.dump 1
70
67
  expect(resource.dump).to eql(1)
71
68
  end
72
69
 
73
- it "allows you to set the pass attribute" do
70
+ it "allows you to set the pass property" do
74
71
  resource.pass 1
75
72
  expect(resource.pass).to eql(1)
76
73
  end
77
74
 
78
- it "sets the options attribute to defaults" do
75
+ it "sets the options property to defaults" do
79
76
  expect(resource.options).to eql(["defaults"])
80
77
  end
81
78
 
@@ -84,7 +81,7 @@ describe Chef::Resource::Mount do
84
81
  expect(resource.options).to be_a_kind_of(Array)
85
82
  end
86
83
 
87
- it "allows options attribute as an array" do
84
+ it "allows options property as an array" do
88
85
  resource.options %w{ro nosuid}
89
86
  expect(resource.options).to be_a_kind_of(Array)
90
87
  end
@@ -33,6 +33,16 @@ describe Chef::Resource::MsuPackage do
33
33
  expect(resource.action).to eql([:install])
34
34
  end
35
35
 
36
+ it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
37
+ expect { resource.action :install }.not_to raise_error
38
+ expect { resource.action :lock }.not_to raise_error
39
+ expect { resource.action :purge }.not_to raise_error
40
+ expect { resource.action :reconfig }.not_to raise_error
41
+ expect { resource.action :remove }.not_to raise_error
42
+ expect { resource.action :unlock }.not_to raise_error
43
+ expect { resource.action :upgrade }.not_to raise_error
44
+ end
45
+
36
46
  it "coerces name property to package_name property" do
37
47
  expect(resource.package_name).to eql("test_pkg")
38
48
  end
@@ -19,25 +19,26 @@ require "spec_helper"
19
19
 
20
20
  describe Chef::Resource::OhaiHint do
21
21
 
22
- let(:resource) { Chef::Resource::OhaiHint.new("foo") }
22
+ let(:resource) { Chef::Resource::OhaiHint.new("fakey_fakerton") }
23
23
 
24
24
  it "has a resource name of :ohai_hint" do
25
25
  expect(resource.resource_name).to eql(:ohai_hint)
26
26
  end
27
27
 
28
- it "has a default action of create" do
28
+ it "the hint_name property is the name_property" do
29
+ expect(resource.hint_name).to eql("fakey_fakerton")
30
+ end
31
+
32
+ it "sets the default action as :create" do
29
33
  expect(resource.action).to eql([:create])
30
34
  end
31
35
 
32
- it "supports the :nothing, :create and :delete actions" do
33
- expect(resource.allowed_actions).to include(:nothing, :create, :delete)
36
+ it "supports :create, :delete actions" do
37
+ expect { resource.action :create }.not_to raise_error
38
+ expect { resource.action :delete }.not_to raise_error
34
39
  end
35
40
 
36
41
  it "runs at compile_time by default" do
37
42
  expect(resource.compile_time).to eql(true)
38
43
  end
39
-
40
- it "the hint_name property is the name property" do
41
- expect(resource.hint_name).to eql("foo")
42
- end
43
44
  end
@@ -20,17 +20,25 @@ require "spec_helper"
20
20
 
21
21
  describe Chef::Resource::Ohai do
22
22
 
23
- let(:resource) { Chef::Resource::Ohai.new("ohai_reload") }
23
+ let(:resource) { Chef::Resource::Ohai.new("fakey_fakerton") }
24
24
 
25
25
  it "has a resource name of :ohai" do
26
26
  expect(resource.resource_name).to eql(:ohai)
27
27
  end
28
28
 
29
- it "has a default action of reload" do
29
+ it "the ohai_name property is the name_property" do
30
+ expect(resource.ohai_name).to eql("fakey_fakerton")
31
+ end
32
+
33
+ it "sets the default action as :reload" do
30
34
  expect(resource.action).to eql([:reload])
31
35
  end
32
36
 
33
- it "allows you to set the plugin attribute" do
37
+ it "supports :reload action" do
38
+ expect { resource.action :reload }.not_to raise_error
39
+ end
40
+
41
+ it "allows you to set the plugin property" do
34
42
  resource.plugin "passwd"
35
43
  expect(resource.plugin).to eql("passwd")
36
44
  end
@@ -36,6 +36,20 @@ describe Chef::Resource::OpenbsdPackage do
36
36
  expect(resource.resource_name).to eql(:openbsd_package)
37
37
  end
38
38
 
39
+ it "sets the default action as :install" do
40
+ expect(resource.action).to eql([:install])
41
+ end
42
+
43
+ it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
44
+ expect { resource.action :install }.not_to raise_error
45
+ expect { resource.action :lock }.not_to raise_error
46
+ expect { resource.action :purge }.not_to raise_error
47
+ expect { resource.action :reconfig }.not_to raise_error
48
+ expect { resource.action :remove }.not_to raise_error
49
+ expect { resource.action :unlock }.not_to raise_error
50
+ expect { resource.action :upgrade }.not_to raise_error
51
+ end
52
+
39
53
  it "does not set the provider" do
40
54
  expect(resource.provider).to be_nil
41
55
  end
@@ -19,16 +19,24 @@ require "spec_helper"
19
19
 
20
20
  describe Chef::Resource::OpensslDhparam do
21
21
 
22
- let(:resource) { Chef::Resource::OpensslDhparam.new("dhparam") }
22
+ let(:resource) { Chef::Resource::OpensslDhparam.new("fakey_fakerton") }
23
23
 
24
24
  it "has a resource name of :openssl_dhparam" do
25
25
  expect(resource.resource_name).to eql(:openssl_dhparam)
26
26
  end
27
27
 
28
- it "has a default action of create" do
28
+ it "the path property is the name_property" do
29
+ expect(resource.path).to eql("fakey_fakerton")
30
+ end
31
+
32
+ it "sets the default action as :create" do
29
33
  expect(resource.action).to eql([:create])
30
34
  end
31
35
 
36
+ it "supports :create action" do
37
+ expect { resource.action :create }.not_to raise_error
38
+ end
39
+
32
40
  it "has a default mode of '0640'" do
33
41
  expect(resource.mode).to eql("0640")
34
42
  end
@@ -45,7 +53,4 @@ describe Chef::Resource::OpensslDhparam do
45
53
  expect { resource.key_length 1234 }.to raise_error(ArgumentError)
46
54
  end
47
55
 
48
- it "the path property is the name property" do
49
- expect(resource.path).to eql("dhparam")
50
- end
51
56
  end
@@ -19,16 +19,24 @@ require "spec_helper"
19
19
 
20
20
  describe Chef::Resource::OpensslRsaPrivateKey do
21
21
 
22
- let(:resource) { Chef::Resource::OpensslRsaPrivateKey.new("key") }
22
+ let(:resource) { Chef::Resource::OpensslRsaPrivateKey.new("fakey_fakerton") }
23
23
 
24
24
  it "has a resource name of :openssl_rsa_private_key" do
25
25
  expect(resource.resource_name).to eql(:openssl_rsa_private_key)
26
26
  end
27
27
 
28
- it "has a default action of create" do
28
+ it "the path property is the name_property" do
29
+ expect(resource.path).to eql("fakey_fakerton")
30
+ end
31
+
32
+ it "sets the default action as :create" do
29
33
  expect(resource.action).to eql([:create])
30
34
  end
31
35
 
36
+ it "supports :create action" do
37
+ expect { resource.action :create }.not_to raise_error
38
+ end
39
+
32
40
  it "has a default mode of '0600'" do
33
41
  expect(resource.mode).to eql("0600")
34
42
  end
@@ -53,7 +61,4 @@ describe Chef::Resource::OpensslRsaPrivateKey do
53
61
  expect(resource.force).to eql(false)
54
62
  end
55
63
 
56
- it "the path property is the name property" do
57
- expect(resource.path).to eql("key")
58
- end
59
64
  end
@@ -25,15 +25,19 @@ describe Chef::Resource::OpensslRsaPublicKey do
25
25
  expect(resource.resource_name).to eql(:openssl_rsa_public_key)
26
26
  end
27
27
 
28
- it "has a default action of create" do
28
+ it "the path property is the name_property" do
29
+ expect(resource.path).to eql("key")
30
+ end
31
+
32
+ it "sets the default action as :create" do
29
33
  expect(resource.action).to eql([:create])
30
34
  end
31
35
 
32
- it "has a default mode of '0640'" do
33
- expect(resource.mode).to eql("0640")
36
+ it "supports :create action" do
37
+ expect { resource.action :create }.not_to raise_error
34
38
  end
35
39
 
36
- it "the path property is the name property" do
37
- expect(resource.path).to eql("key")
40
+ it "has a default mode of '0640'" do
41
+ expect(resource.mode).to eql("0640")
38
42
  end
39
43
  end
@@ -21,19 +21,22 @@ require "spec_helper"
21
21
  describe Chef::Resource::OsxProfile do
22
22
  let(:resource) do
23
23
  Chef::Resource::OsxProfile.new(
24
- "Test Profile Resource",
25
- run_context)
24
+ "fakey_fakerton")
26
25
  end
27
26
 
28
27
  it "has a resource name of profile" do
29
28
  expect(resource.resource_name).to eql(:osx_profile)
30
29
  end
31
30
 
32
- it "has a default action of install" do
31
+ it "the profile_name property is the name_property" do
32
+ expect(resource.profile_name).to eql("fakey_fakerton")
33
+ end
34
+
35
+ it "sets the default action as :install" do
33
36
  expect(resource.action).to eql([:install])
34
37
  end
35
38
 
36
- it "accepts install and remove as actions" do
39
+ it "supports :install, :remove actions" do
37
40
  expect { resource.action :install }.not_to raise_error
38
41
  expect { resource.action :remove }.not_to raise_error
39
42
  end
@@ -26,6 +26,20 @@ describe Chef::Resource::Package do
26
26
  expect(resource.package_name).to eql("emacs")
27
27
  end
28
28
 
29
+ it "sets the default action as :install" do
30
+ expect(resource.action).to eql([:install])
31
+ end
32
+
33
+ it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
34
+ expect { resource.action :install }.not_to raise_error
35
+ expect { resource.action :lock }.not_to raise_error
36
+ expect { resource.action :purge }.not_to raise_error
37
+ expect { resource.action :reconfig }.not_to raise_error
38
+ expect { resource.action :remove }.not_to raise_error
39
+ expect { resource.action :unlock }.not_to raise_error
40
+ expect { resource.action :upgrade }.not_to raise_error
41
+ end
42
+
29
43
  it "accepts a string for the package name" do
30
44
  resource.package_name "something"
31
45
  expect(resource.package_name).to eql("something")
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Jan Zimmek (<jan.zimmek@web.de>)
3
3
  # Copyright:: Copyright 2010-2016, Jan Zimmek
4
+ # Copyright:: 2018, Chef Software, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,10 +18,8 @@
17
18
  #
18
19
 
19
20
  require "spec_helper"
20
- require "support/shared/unit/resource/static_provider_resolution"
21
-
22
- describe Chef::Resource::PacmanPackage, "initialize" do
23
21
 
22
+ describe Chef::Resource::PacmanPackage do
24
23
  static_provider_resolution(
25
24
  resource: Chef::Resource::PacmanPackage,
26
25
  provider: Chef::Provider::Package::Pacman,
@@ -29,4 +28,19 @@ describe Chef::Resource::PacmanPackage, "initialize" do
29
28
  os: "linux"
30
29
  )
31
30
 
31
+ let(:resource) { Chef::Resource::PacmanPackage.new("fakey_fakerton") }
32
+
33
+ it "sets the default action as :install" do
34
+ expect(resource.action).to eql([:install])
35
+ end
36
+
37
+ it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
38
+ expect { resource.action :install }.not_to raise_error
39
+ expect { resource.action :lock }.not_to raise_error
40
+ expect { resource.action :purge }.not_to raise_error
41
+ expect { resource.action :reconfig }.not_to raise_error
42
+ expect { resource.action :remove }.not_to raise_error
43
+ expect { resource.action :unlock }.not_to raise_error
44
+ expect { resource.action :upgrade }.not_to raise_error
45
+ end
32
46
  end
@@ -0,0 +1,36 @@
1
+ #
2
+ # Copyright:: Copyright 2018, Chef Software, Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require "spec_helper"
19
+
20
+ describe Chef::Resource::PaludisPackage do
21
+ let(:resource) { Chef::Resource::PaludisPackage.new("fakey_fakerton") }
22
+
23
+ it "sets the default action as :install" do
24
+ expect(resource.action).to eql([:install])
25
+ end
26
+
27
+ it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
28
+ expect { resource.action :install }.not_to raise_error
29
+ expect { resource.action :lock }.not_to raise_error
30
+ expect { resource.action :purge }.not_to raise_error
31
+ expect { resource.action :reconfig }.not_to raise_error
32
+ expect { resource.action :remove }.not_to raise_error
33
+ expect { resource.action :unlock }.not_to raise_error
34
+ expect { resource.action :upgrade }.not_to raise_error
35
+ end
36
+ end
@@ -33,4 +33,12 @@ describe Chef::Resource::Perl do
33
33
  it "has an interpreter of perl" do
34
34
  expect(resource.interpreter).to eql("perl")
35
35
  end
36
+
37
+ it "sets the default action as :run" do
38
+ expect(resource.action).to eql([:run])
39
+ end
40
+
41
+ it "supports :run action" do
42
+ expect { resource.action :run }.not_to raise_error
43
+ end
36
44
  end
@@ -29,4 +29,18 @@ describe Chef::Resource::PortagePackage, "initialize" do
29
29
  it "sets the resource_name to :portage_package" do
30
30
  expect(resource.resource_name).to eql(:portage_package)
31
31
  end
32
+
33
+ it "sets the default action as :install" do
34
+ expect(resource.action).to eql([:install])
35
+ end
36
+
37
+ it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
38
+ expect { resource.action :install }.not_to raise_error
39
+ expect { resource.action :lock }.not_to raise_error
40
+ expect { resource.action :purge }.not_to raise_error
41
+ expect { resource.action :reconfig }.not_to raise_error
42
+ expect { resource.action :remove }.not_to raise_error
43
+ expect { resource.action :unlock }.not_to raise_error
44
+ expect { resource.action :upgrade }.not_to raise_error
45
+ end
32
46
  end