chef 13.6.4-universal-mingw32 → 13.7.16-universal-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. checksums.yaml +5 -5
  2. data/VERSION +1 -1
  3. data/acceptance/Gemfile +2 -2
  4. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +1 -6
  5. data/distro/powershell/chef/chef.psm1 +1 -5
  6. data/lib/chef/api_client.rb +5 -5
  7. data/lib/chef/api_client_v1.rb +6 -6
  8. data/lib/chef/application.rb +3 -2
  9. data/lib/chef/application/knife.rb +4 -0
  10. data/lib/chef/chef_class.rb +2 -2
  11. data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
  12. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -4
  13. data/lib/chef/client.rb +3 -3
  14. data/lib/chef/cookbook/chefignore.rb +4 -0
  15. data/lib/chef/cookbook/cookbook_collection.rb +2 -2
  16. data/lib/chef/cookbook/metadata.rb +2 -2
  17. data/lib/chef/data_bag.rb +1 -1
  18. data/lib/chef/deprecated.rb +10 -0
  19. data/lib/chef/event_dispatch/base.rb +2 -2
  20. data/lib/chef/http.rb +10 -10
  21. data/lib/chef/knife.rb +16 -15
  22. data/lib/chef/knife/configure.rb +12 -36
  23. data/lib/chef/knife/cookbook_upload.rb +4 -4
  24. data/lib/chef/knife/core/bootstrap_context.rb +1 -1
  25. data/lib/chef/knife/core/status_presenter.rb +6 -2
  26. data/lib/chef/knife/core/ui.rb +1 -1
  27. data/lib/chef/knife/data_bag_secret_options.rb +1 -1
  28. data/lib/chef/knife/data_bag_show.rb +1 -1
  29. data/lib/chef/knife/edit.rb +1 -1
  30. data/lib/chef/knife/ssh.rb +47 -35
  31. data/lib/chef/knife/user_create.rb +2 -0
  32. data/lib/chef/knife/user_delete.rb +2 -0
  33. data/lib/chef/knife/user_edit.rb +2 -0
  34. data/lib/chef/knife/user_reregister.rb +2 -0
  35. data/lib/chef/knife/user_show.rb +2 -0
  36. data/lib/chef/mixin/powershell_out.rb +1 -1
  37. data/lib/chef/node/attribute.rb +46 -70
  38. data/lib/chef/node/attribute_collections.rb +5 -5
  39. data/lib/chef/node/common_api.rb +1 -1
  40. data/lib/chef/node/immutable_collections.rb +180 -23
  41. data/lib/chef/node/mixin/state_tracking.rb +6 -6
  42. data/lib/chef/node_map.rb +63 -45
  43. data/lib/chef/property.rb +8 -8
  44. data/lib/chef/provider.rb +9 -3
  45. data/lib/chef/provider/apt_preference.rb +1 -1
  46. data/lib/chef/provider/apt_repository.rb +1 -1
  47. data/lib/chef/provider/apt_update.rb +1 -1
  48. data/lib/chef/provider/file.rb +1 -1
  49. data/lib/chef/provider/group/dscl.rb +6 -2
  50. data/lib/chef/provider/ifconfig.rb +96 -34
  51. data/lib/chef/provider/launchd.rb +0 -1
  52. data/lib/chef/provider/log.rb +3 -13
  53. data/lib/chef/provider/package/dnf.rb +1 -1
  54. data/lib/chef/provider/package/smartos.rb +2 -2
  55. data/lib/chef/provider/reboot.rb +12 -0
  56. data/lib/chef/provider/remote_directory.rb +1 -1
  57. data/lib/chef/provider/remote_file/http.rb +3 -2
  58. data/lib/chef/provider/service/solaris.rb +6 -2
  59. data/lib/chef/provider/systemd_unit.rb +34 -33
  60. data/lib/chef/provider/user/dscl.rb +1 -1
  61. data/lib/chef/provider/windows_path.rb +6 -7
  62. data/lib/chef/provider/windows_task.rb +89 -33
  63. data/lib/chef/provider/yum_repository.rb +24 -9
  64. data/lib/chef/resource/apt_package.rb +1 -0
  65. data/lib/chef/resource/apt_preference.rb +4 -0
  66. data/lib/chef/resource/apt_repository.rb +4 -0
  67. data/lib/chef/resource/apt_update.rb +3 -0
  68. data/lib/chef/resource/bash.rb +4 -0
  69. data/lib/chef/resource/batch.rb +5 -0
  70. data/lib/chef/resource/bff_package.rb +4 -0
  71. data/lib/chef/resource/breakpoint.rb +6 -0
  72. data/lib/chef/resource/cab_package.rb +6 -6
  73. data/lib/chef/resource/chef_gem.rb +13 -0
  74. data/lib/chef/resource/chocolatey_package.rb +4 -6
  75. data/lib/chef/resource/cookbook_file.rb +13 -15
  76. data/lib/chef/resource/cron.rb +2 -0
  77. data/lib/chef/resource/csh.rb +4 -0
  78. data/lib/chef/resource/directory.rb +8 -26
  79. data/lib/chef/resource/dnf_package.rb +5 -0
  80. data/lib/chef/resource/dpkg_package.rb +2 -0
  81. data/lib/chef/resource/dsc_resource.rb +5 -0
  82. data/lib/chef/resource/dsc_script.rb +6 -0
  83. data/lib/chef/resource/env.rb +3 -0
  84. data/lib/chef/resource/erl_call.rb +5 -0
  85. data/lib/chef/resource/execute.rb +5 -1
  86. data/lib/chef/resource/file.rb +2 -1
  87. data/lib/chef/resource/file/verification.rb +10 -0
  88. data/lib/chef/resource/freebsd_package.rb +10 -2
  89. data/lib/chef/resource/gem_package.rb +2 -0
  90. data/lib/chef/resource/git.rb +2 -0
  91. data/lib/chef/resource/group.rb +1 -0
  92. data/lib/chef/resource/homebrew_package.rb +3 -0
  93. data/lib/chef/resource/http_request.rb +2 -0
  94. data/lib/chef/resource/ifconfig.rb +23 -150
  95. data/lib/chef/resource/ips_package.rb +1 -0
  96. data/lib/chef/resource/ksh.rb +6 -0
  97. data/lib/chef/resource/launchd.rb +5 -4
  98. data/lib/chef/resource/link.rb +10 -0
  99. data/lib/chef/resource/log.rb +19 -46
  100. data/lib/chef/resource/macports_package.rb +1 -0
  101. data/lib/chef/resource/mdadm.rb +4 -0
  102. data/lib/chef/resource/mount.rb +1 -0
  103. data/lib/chef/resource/msu_package.rb +7 -8
  104. data/lib/chef/resource/ohai.rb +2 -0
  105. data/lib/chef/resource/openbsd_package.rb +3 -0
  106. data/lib/chef/resource/osx_profile.rb +10 -40
  107. data/lib/chef/resource/package.rb +6 -0
  108. data/lib/chef/resource/pacman_package.rb +1 -0
  109. data/lib/chef/resource/paludis_package.rb +3 -0
  110. data/lib/chef/resource/perl.rb +4 -0
  111. data/lib/chef/resource/portage_package.rb +1 -0
  112. data/lib/chef/resource/powershell_package.rb +5 -0
  113. data/lib/chef/resource/powershell_script.rb +8 -0
  114. data/lib/chef/resource/python.rb +4 -0
  115. data/lib/chef/resource/reboot.rb +14 -20
  116. data/lib/chef/resource/registry_key.rb +1 -0
  117. data/lib/chef/resource/remote_directory.rb +3 -0
  118. data/lib/chef/resource/remote_file.rb +2 -0
  119. data/lib/chef/resource/resource_notification.rb +17 -0
  120. data/lib/chef/resource/route.rb +1 -0
  121. data/lib/chef/resource/rpm_package.rb +1 -0
  122. data/lib/chef/resource/ruby.rb +4 -0
  123. data/lib/chef/resource/ruby_block.rb +3 -0
  124. data/lib/chef/resource/script.rb +4 -0
  125. data/lib/chef/resource/service.rb +1 -0
  126. data/lib/chef/resource/smartos_package.rb +1 -0
  127. data/lib/chef/resource/solaris_package.rb +1 -0
  128. data/lib/chef/resource/subversion.rb +1 -0
  129. data/lib/chef/resource/systemd_unit.rb +6 -0
  130. data/lib/chef/resource/template.rb +9 -0
  131. data/lib/chef/resource/user.rb +1 -0
  132. data/lib/chef/resource/windows_package.rb +2 -0
  133. data/lib/chef/resource/windows_path.rb +5 -10
  134. data/lib/chef/resource/windows_service.rb +3 -0
  135. data/lib/chef/resource/windows_task.rb +66 -87
  136. data/lib/chef/resource/yum_repository.rb +26 -22
  137. data/lib/chef/resource/zypper_package.rb +2 -0
  138. data/lib/chef/resource/zypper_repository.rb +6 -1
  139. data/lib/chef/run_context.rb +8 -2
  140. data/lib/chef/server_api.rb +1 -0
  141. data/lib/chef/util/selinux.rb +5 -4
  142. data/lib/chef/version.rb +1 -1
  143. data/lib/chef/version/platform.rb +18 -0
  144. data/lib/chef/version_constraint/platform.rb +2 -0
  145. data/spec/data/client.d_00/02-strings.rb +2 -0
  146. data/spec/functional/assets/chefinittest +6 -4
  147. data/spec/functional/knife/ssh_spec.rb +54 -7
  148. data/spec/functional/resource/bff_spec.rb +3 -3
  149. data/spec/functional/resource/ifconfig_spec.rb +1 -1
  150. data/spec/functional/resource/mount_spec.rb +7 -3
  151. data/spec/functional/resource/user/useradd_spec.rb +4 -4
  152. data/spec/functional/resource/windows_task_spec.rb +6 -6
  153. data/spec/functional/win32/security_spec.rb +7 -33
  154. data/spec/integration/knife/data_bag_show_spec.rb +1 -1
  155. data/spec/integration/recipes/noop_resource_spec.rb +1 -1
  156. data/spec/integration/recipes/recipe_dsl_spec.rb +30 -30
  157. data/spec/integration/recipes/resource_action_spec.rb +2 -2
  158. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +71 -15
  159. data/spec/spec_helper.rb +19 -0
  160. data/spec/support/shared/functional/execute_resource.rb +1 -1
  161. data/spec/support/shared/unit/application_dot_d.rb +2 -0
  162. data/spec/support/shared/unit/execute_resource.rb +8 -1
  163. data/spec/support/shared/unit/provider/file.rb +9 -1
  164. data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +10 -7
  165. data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +2 -2
  166. data/spec/unit/client_spec.rb +1 -1
  167. data/spec/unit/deprecated_spec.rb +4 -4
  168. data/spec/unit/http_spec.rb +9 -0
  169. data/spec/unit/knife/bootstrap_spec.rb +5 -0
  170. data/spec/unit/knife/configure_spec.rb +10 -60
  171. data/spec/unit/knife/data_bag_create_spec.rb +40 -2
  172. data/spec/unit/knife/data_bag_show_spec.rb +16 -2
  173. data/spec/unit/knife/ssh_spec.rb +85 -39
  174. data/spec/unit/knife_spec.rb +2 -0
  175. data/spec/unit/lwrp_spec.rb +5 -3
  176. data/spec/unit/mixin/powershell_type_coercions_spec.rb +7 -6
  177. data/spec/unit/node/attribute_spec.rb +55 -24
  178. data/spec/unit/node/immutable_collections_spec.rb +28 -14
  179. data/spec/unit/node/vivid_mash_spec.rb +27 -10
  180. data/spec/unit/node_map_spec.rb +34 -0
  181. data/spec/unit/property_spec.rb +13 -13
  182. data/spec/unit/provider/group/dscl_spec.rb +14 -5
  183. data/spec/unit/provider/ifconfig_spec.rb +10 -3
  184. data/spec/unit/provider/remote_file/http_spec.rb +23 -19
  185. data/spec/unit/provider/service/solaris_smf_service_spec.rb +6 -5
  186. data/spec/unit/provider/user/dscl_spec.rb +26 -0
  187. data/spec/unit/provider/windows_task_spec.rb +148 -4
  188. data/spec/unit/provider_spec.rb +1 -1
  189. data/spec/unit/resource/apt_package_spec.rb +1 -1
  190. data/spec/unit/resource/bash_spec.rb +8 -10
  191. data/spec/unit/resource/batch_spec.rb +1 -1
  192. data/spec/unit/resource/cab_package_spec.rb +19 -1
  193. data/spec/unit/resource/chef_gem_spec.rb +3 -3
  194. data/spec/unit/resource/chocolatey_package_spec.rb +10 -10
  195. data/spec/unit/resource/conditional_spec.rb +2 -2
  196. data/spec/unit/resource/cookbook_file_spec.rb +24 -30
  197. data/spec/unit/resource/cron_spec.rb +79 -82
  198. data/spec/unit/resource/csh_spec.rb +8 -10
  199. data/spec/unit/resource/deploy_spec.rb +1 -1
  200. data/spec/unit/resource/directory_spec.rb +28 -31
  201. data/spec/unit/resource/dnf_package_spec.rb +9 -9
  202. data/spec/unit/resource/env_spec.rb +7 -7
  203. data/spec/unit/resource/erl_call_spec.rb +9 -9
  204. data/spec/unit/resource/execute_spec.rb +6 -6
  205. data/spec/unit/resource/file/verification_spec.rb +18 -4
  206. data/spec/unit/resource/file_spec.rb +53 -56
  207. data/spec/unit/resource/freebsd_package_spec.rb +7 -7
  208. data/spec/unit/resource/gem_package_spec.rb +1 -1
  209. data/spec/unit/resource/git_spec.rb +7 -9
  210. data/spec/unit/resource/group_spec.rb +60 -70
  211. data/spec/unit/resource/http_request_spec.rb +16 -19
  212. data/spec/unit/resource/ifconfig_spec.rb +3 -3
  213. data/spec/unit/resource/ips_package_spec.rb +3 -5
  214. data/spec/unit/resource/ksh_spec.rb +8 -10
  215. data/spec/unit/resource/launchd_spec.rb +17 -10
  216. data/spec/unit/resource/link_spec.rb +53 -53
  217. data/spec/unit/resource/log_spec.rb +24 -28
  218. data/spec/unit/resource/mdadm_spec.rb +42 -44
  219. data/spec/unit/resource/mount_spec.rb +97 -99
  220. data/spec/unit/resource/msu_package_spec.rb +14 -8
  221. data/spec/unit/resource/ohai_spec.rb +15 -17
  222. data/spec/unit/resource/openbsd_package_spec.rb +3 -3
  223. data/spec/unit/resource/osx_profile_spec.rb +7 -7
  224. data/spec/unit/resource/package_spec.rb +36 -40
  225. data/spec/unit/resource/perl_spec.rb +8 -11
  226. data/spec/unit/resource/portage_package_spec.rb +8 -10
  227. data/spec/unit/resource/powershell_package_spec.rb +9 -9
  228. data/spec/unit/resource/python_spec.rb +8 -11
  229. data/spec/unit/resource/reboot_spec.rb +50 -0
  230. data/spec/unit/resource/registry_key_spec.rb +84 -98
  231. data/spec/unit/resource/remote_directory_spec.rb +40 -42
  232. data/spec/unit/resource/remote_file_spec.rb +78 -80
  233. data/spec/unit/resource/route_spec.rb +42 -44
  234. data/spec/unit/resource/rpm_package_spec.rb +5 -7
  235. data/spec/unit/resource/ruby_block_spec.rb +14 -16
  236. data/spec/unit/resource/ruby_spec.rb +8 -12
  237. data/spec/unit/resource/scm_spec.rb +66 -69
  238. data/spec/unit/resource/script_spec.rb +1 -1
  239. data/spec/unit/resource/service_spec.rb +80 -83
  240. data/spec/unit/resource/smartos_package_spec.rb +5 -0
  241. data/spec/unit/resource/solaris_package_spec.rb +3 -5
  242. data/spec/unit/resource/subversion_spec.rb +18 -16
  243. data/spec/unit/resource/systemd_unit_spec.rb +50 -54
  244. data/spec/unit/resource/template_spec.rb +56 -61
  245. data/spec/unit/resource/user_spec.rb +47 -53
  246. data/spec/unit/resource/windows_package_spec.rb +1 -1
  247. data/spec/unit/resource/windows_path_spec.rb +11 -8
  248. data/spec/unit/resource/windows_task_spec.rb +129 -33
  249. data/spec/unit/resource/yum_package_spec.rb +1 -1
  250. data/spec/unit/resource/yum_repository_spec.rb +61 -8
  251. data/spec/unit/resource/zypper_repository_spec.rb +17 -18
  252. data/spec/unit/util/selinux_spec.rb +3 -6
  253. data/tasks/dependencies.rb +0 -5
  254. data/tasks/rspec.rb +1 -1
  255. metadata +7 -19
  256. data/acceptance/.DS_Store +0 -0
  257. data/acceptance/.bundle/config +0 -2
  258. data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
  259. data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
  260. data/distro/.DS_Store +0 -0
  261. data/lib/.DS_Store +0 -0
  262. data/lib/chef/.DS_Store +0 -0
  263. data/lib/chef/knife/.DS_Store +0 -0
  264. data/lib/chef/mixin/.DS_Store +0 -0
  265. data/spec/.DS_Store +0 -0
  266. data/spec/functional/.DS_Store +0 -0
  267. data/spec/support/.DS_Store +0 -0
  268. data/spec/unit/.DS_Store +0 -0
  269. data/tasks/.DS_Store +0 -0
@@ -35,7 +35,7 @@ describe Chef::Resource::GemPackage, "gem_binary" do
35
35
  @resource = Chef::Resource::GemPackage.new("foo")
36
36
  end
37
37
 
38
- it "should set the gem_binary variable to whatever is passed in" do
38
+ it "sets the gem_binary variable to whatever is passed in" do
39
39
  @resource.gem_binary("/opt/local/bin/gem")
40
40
  expect(@resource.gem_binary).to eql("/opt/local/bin/gem")
41
41
  end
@@ -28,23 +28,21 @@ describe Chef::Resource::Git do
28
28
  action: :sync
29
29
  )
30
30
 
31
- before(:each) do
32
- @git = Chef::Resource::Git.new("my awesome webapp")
33
- end
31
+ let(:resource) { Chef::Resource::Git.new("my awesome webapp") }
34
32
 
35
33
  it "is a kind of Scm Resource" do
36
- expect(@git).to be_a_kind_of(Chef::Resource::Scm)
37
- expect(@git).to be_an_instance_of(Chef::Resource::Git)
34
+ expect(resource).to be_a_kind_of(Chef::Resource::Scm)
35
+ expect(resource).to be_an_instance_of(Chef::Resource::Git)
38
36
  end
39
37
 
40
38
  it "uses aliases revision as branch" do
41
- @git.branch "HEAD"
42
- expect(@git.revision).to eql("HEAD")
39
+ resource.branch "HEAD"
40
+ expect(resource.revision).to eql("HEAD")
43
41
  end
44
42
 
45
43
  it "aliases revision as reference" do
46
- @git.reference "v1.0 tag"
47
- expect(@git.revision).to eql("v1.0 tag")
44
+ resource.reference "v1.0 tag"
45
+ expect(resource.revision).to eql("v1.0 tag")
48
46
  end
49
47
 
50
48
  end
@@ -20,143 +20,133 @@
20
20
  require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::Group, "initialize" do
23
- before(:each) do
24
- @resource = Chef::Resource::Group.new("admin")
25
- end
23
+ let(:resource) { Chef::Resource::Group.new("admin") }
26
24
 
27
- it "should create a new Chef::Resource::Group" do
28
- expect(@resource).to be_a_kind_of(Chef::Resource)
29
- expect(@resource).to be_a_kind_of(Chef::Resource::Group)
25
+ it "creates a new Chef::Resource::Group" do
26
+ expect(resource).to be_a_kind_of(Chef::Resource)
27
+ expect(resource).to be_a_kind_of(Chef::Resource::Group)
30
28
  end
31
29
 
32
- it "should set the resource_name to :group" do
33
- expect(@resource.resource_name).to eql(:group)
30
+ it "sets the resource_name to :group" do
31
+ expect(resource.resource_name).to eql(:group)
34
32
  end
35
33
 
36
- it "should set the group_name equal to the argument to initialize" do
37
- expect(@resource.group_name).to eql("admin")
34
+ it "sets the group_name equal to the argument to initialize" do
35
+ expect(resource.group_name).to eql("admin")
38
36
  end
39
37
 
40
- it "should default gid to nil" do
41
- expect(@resource.gid).to eql(nil)
38
+ it "defaults gid to nil" do
39
+ expect(resource.gid).to eql(nil)
42
40
  end
43
41
 
44
- it "should default members to an empty array" do
45
- expect(@resource.members).to eql([])
42
+ it "defaults members to an empty array" do
43
+ expect(resource.members).to eql([])
46
44
  end
47
45
 
48
- it "should alias users to members, also an empty array" do
49
- expect(@resource.users).to eql([])
46
+ it "aliases users to members, also an empty array" do
47
+ expect(resource.users).to eql([])
50
48
  end
51
49
 
52
- it "should set action to :create" do
53
- expect(@resource.action).to eql([:create])
50
+ it "sets action to :create" do
51
+ expect(resource.action).to eql([:create])
54
52
  end
55
53
 
56
54
  %w{create remove modify manage}.each do |action|
57
- it "should allow action #{action}" do
58
- expect(@resource.allowed_actions.detect { |a| a == action.to_sym }).to eql(action.to_sym)
55
+ it "allows action #{action}" do
56
+ expect(resource.allowed_actions.detect { |a| a == action.to_sym }).to eql(action.to_sym)
59
57
  end
60
58
  end
61
59
 
62
- it "should accept domain groups (@ or \ separator) on non-windows" do
63
- expect { @resource.group_name "domain\@group" }.not_to raise_error
64
- expect(@resource.group_name).to eq("domain\@group")
65
- expect { @resource.group_name "domain\\group" }.not_to raise_error
66
- expect(@resource.group_name).to eq("domain\\group")
67
- expect { @resource.group_name "domain\\group^name" }.not_to raise_error
68
- expect(@resource.group_name).to eq("domain\\group^name")
60
+ it "accepts domain groups (@ or \ separator) on non-windows" do
61
+ expect { resource.group_name "domain\@group" }.not_to raise_error
62
+ expect(resource.group_name).to eq("domain\@group")
63
+ expect { resource.group_name "domain\\group" }.not_to raise_error
64
+ expect(resource.group_name).to eq("domain\\group")
65
+ expect { resource.group_name "domain\\group^name" }.not_to raise_error
66
+ expect(resource.group_name).to eq("domain\\group^name")
69
67
  end
70
68
  end
71
69
 
72
70
  describe Chef::Resource::Group, "group_name" do
73
- before(:each) do
74
- @resource = Chef::Resource::Group.new("admin")
75
- end
71
+ let(:resource) { Chef::Resource::Group.new("admin") }
76
72
 
77
- it "should allow a string" do
78
- @resource.group_name "pirates"
79
- expect(@resource.group_name).to eql("pirates")
73
+ it "allows a string" do
74
+ resource.group_name "pirates"
75
+ expect(resource.group_name).to eql("pirates")
80
76
  end
81
77
 
82
- it "should not allow a hash" do
83
- expect { @resource.send(:group_name, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
78
+ it "does not allow a hash" do
79
+ expect { resource.send(:group_name, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
84
80
  end
85
81
  end
86
82
 
87
83
  describe Chef::Resource::Group, "gid" do
88
- before(:each) do
89
- @resource = Chef::Resource::Group.new("admin")
90
- end
84
+ let(:resource) { Chef::Resource::Group.new("admin") }
91
85
 
92
- it "should allow an integer" do
93
- @resource.gid 100
94
- expect(@resource.gid).to eql(100)
86
+ it "allows an integer" do
87
+ resource.gid 100
88
+ expect(resource.gid).to eql(100)
95
89
  end
96
90
 
97
- it "should not allow a hash" do
98
- expect { @resource.send(:gid, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
91
+ it "does not allow a hash" do
92
+ expect { resource.send(:gid, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
99
93
  end
100
94
  end
101
95
 
102
96
  describe Chef::Resource::Group, "members" do
103
- before(:each) do
104
- @resource = Chef::Resource::Group.new("admin")
105
- end
97
+ let(:resource) { Chef::Resource::Group.new("admin") }
106
98
 
107
99
  [ :users, :members].each do |method|
108
- it "(#{method}) should allow and convert a string" do
109
- @resource.send(method, "aj")
110
- expect(@resource.send(method)).to eql(["aj"])
100
+ it "(#{method}) allows and convert a string" do
101
+ resource.send(method, "aj")
102
+ expect(resource.send(method)).to eql(["aj"])
111
103
  end
112
104
 
113
105
  it "(#{method}) should split a string on commas" do
114
- @resource.send(method, "aj,adam")
115
- expect(@resource.send(method)).to eql( %w{aj adam} )
106
+ resource.send(method, "aj,adam")
107
+ expect(resource.send(method)).to eql( %w{aj adam} )
116
108
  end
117
109
 
118
- it "(#{method}) should allow an array" do
119
- @resource.send(method, %w{aj adam})
120
- expect(@resource.send(method)).to eql( %w{aj adam} )
110
+ it "(#{method}) allows an array" do
111
+ resource.send(method, %w{aj adam})
112
+ expect(resource.send(method)).to eql( %w{aj adam} )
121
113
  end
122
114
 
123
- it "(#{method}) should not allow a hash" do
124
- expect { @resource.send(method, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
115
+ it "(#{method}) does not allow a hash" do
116
+ expect { resource.send(method, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
125
117
  end
126
118
  end
127
119
  end
128
120
 
129
121
  describe Chef::Resource::Group, "append" do
130
- before(:each) do
131
- @resource = Chef::Resource::Group.new("admin")
132
- end
122
+ let(:resource) { Chef::Resource::Group.new("admin") }
133
123
 
134
- it "should default to false" do
135
- expect(@resource.append).to eql(false)
124
+ it "defaults to false" do
125
+ expect(resource.append).to eql(false)
136
126
  end
137
127
 
138
- it "should allow a boolean" do
139
- @resource.append true
140
- expect(@resource.append).to eql(true)
128
+ it "allows a boolean" do
129
+ resource.append true
130
+ expect(resource.append).to eql(true)
141
131
  end
142
132
 
143
- it "should not allow a hash" do
144
- expect { @resource.send(:gid, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
133
+ it "does not allow a hash" do
134
+ expect { resource.send(:gid, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
145
135
  end
146
136
 
147
137
  describe "when it has members" do
148
138
  before do
149
- @resource.group_name("pokemon")
150
- @resource.members(%w{blastoise pikachu})
139
+ resource.group_name("pokemon")
140
+ resource.members(%w{blastoise pikachu})
151
141
  end
152
142
 
153
143
  it "describes its state" do
154
- state = @resource.state_for_resource_reporter
144
+ state = resource.state_for_resource_reporter
155
145
  expect(state[:members]).to eql(%w{blastoise pikachu})
156
146
  end
157
147
 
158
148
  it "returns the group name as its identity" do
159
- expect(@resource.identity).to eq("pokemon")
149
+ expect(resource.identity).to eq("pokemon")
160
150
  end
161
151
  end
162
152
  end
@@ -20,39 +20,36 @@
20
20
  require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::HttpRequest do
23
+ let(:resource) { Chef::Resource::HttpRequest.new("fakey_fakerton") }
23
24
 
24
- before(:each) do
25
- @resource = Chef::Resource::HttpRequest.new("fakey_fakerton")
25
+ it "creates a new Chef::Resource::HttpRequest" do
26
+ expect(resource).to be_a_kind_of(Chef::Resource)
27
+ expect(resource).to be_a_kind_of(Chef::Resource::HttpRequest)
26
28
  end
27
29
 
28
- it "should create a new Chef::Resource::HttpRequest" do
29
- expect(@resource).to be_a_kind_of(Chef::Resource)
30
- expect(@resource).to be_a_kind_of(Chef::Resource::HttpRequest)
30
+ it "sets url to a string" do
31
+ resource.url "http://slashdot.org"
32
+ expect(resource.url).to eql("http://slashdot.org")
31
33
  end
32
34
 
33
- it "should set url to a string" do
34
- @resource.url "http://slashdot.org"
35
- expect(@resource.url).to eql("http://slashdot.org")
35
+ it "sets the message to the name by default" do
36
+ expect(resource.message).to eql("fakey_fakerton")
36
37
  end
37
38
 
38
- it "should set the message to the name by default" do
39
- expect(@resource.message).to eql("fakey_fakerton")
40
- end
41
-
42
- it "should set message to a string" do
43
- @resource.message "monkeybars"
44
- expect(@resource.message).to eql("monkeybars")
39
+ it "sets message to a string" do
40
+ resource.message "monkeybars"
41
+ expect(resource.message).to eql("monkeybars")
45
42
  end
46
43
 
47
44
  describe "when it has a message and headers" do
48
45
  before do
49
- @resource.url("http://www.trololol.net")
50
- @resource.message("Get sum post brah.")
51
- @resource.headers({ "head" => "tail" })
46
+ resource.url("http://www.trololol.net")
47
+ resource.message("Get sum post brah.")
48
+ resource.headers({ "head" => "tail" })
52
49
  end
53
50
 
54
51
  it "returns the url as its identity" do
55
- expect(@resource.identity).to eq("http://www.trololol.net")
52
+ expect(resource.identity).to eq("http://www.trololol.net")
56
53
  end
57
54
  end
58
55
 
@@ -55,7 +55,7 @@ describe Chef::Resource::Ifconfig do
55
55
  @node.automatic_attrs[:platform_version] = version
56
56
  end
57
57
 
58
- it "should use an ordinary Provider::Ifconfig as a provider for #{platform} #{version}" do
58
+ it "uses an ordinary Provider::Ifconfig as a provider for #{platform} #{version}" do
59
59
  expect(@resource.provider_for_action(:add).class).to eq(Chef::Provider::Ifconfig)
60
60
  end
61
61
  end
@@ -68,7 +68,7 @@ describe Chef::Resource::Ifconfig do
68
68
  @node.automatic_attrs[:platform_version] = version
69
69
  end
70
70
 
71
- it "should use an Provider::Ifconfig::Redhat as a provider for #{platform} #{version}" do
71
+ it "uses an Provider::Ifconfig::Redhat as a provider for #{platform} #{version}" do
72
72
  expect(@resource.provider_for_action(:add)).to be_a_kind_of(Chef::Provider::Ifconfig::Redhat)
73
73
  end
74
74
  end
@@ -81,7 +81,7 @@ describe Chef::Resource::Ifconfig do
81
81
  @node.automatic_attrs[:platform_version] = version
82
82
  end
83
83
 
84
- it "should use an Ifconfig::Debian as a provider for #{platform} #{version}" do
84
+ it "uses an Ifconfig::Debian as a provider for #{platform} #{version}" do
85
85
  expect(@resource.provider_for_action(:add)).to be_a_kind_of(Chef::Provider::Ifconfig::Debian)
86
86
  end
87
87
  end
@@ -29,12 +29,10 @@ describe Chef::Resource::IpsPackage, "initialize" do
29
29
  os: "solaris2"
30
30
  )
31
31
 
32
- before(:each) do
33
- @resource = Chef::Resource::IpsPackage.new("crypto/gnupg")
34
- end
32
+ let(:resource) { Chef::Resource::IpsPackage.new("crypto/gnupg") }
35
33
 
36
34
  it "should support accept_license" do
37
- @resource.accept_license(true)
38
- expect(@resource.accept_license).to eql(true)
35
+ resource.accept_license(true)
36
+ expect(resource.accept_license).to eql(true)
39
37
  end
40
38
  end
@@ -20,21 +20,19 @@ require "spec_helper"
20
20
 
21
21
  describe Chef::Resource::Ksh do
22
22
 
23
- before(:each) do
24
- @resource = Chef::Resource::Ksh.new("fakey_fakerton")
25
- end
23
+ let(:resource) { Chef::Resource::Ksh.new("fakey_fakerton") }
26
24
 
27
- it "should create a new Chef::Resource::Ksh" do
28
- expect(@resource).to be_a_kind_of(Chef::Resource)
29
- expect(@resource).to be_a_kind_of(Chef::Resource::Ksh)
25
+ it "creates a new Chef::Resource::Ksh" do
26
+ expect(resource).to be_a_kind_of(Chef::Resource)
27
+ expect(resource).to be_a_kind_of(Chef::Resource::Ksh)
30
28
  end
31
29
 
32
- it "should have a resource name of :ksh" do
33
- expect(@resource.resource_name).to eql(:ksh)
30
+ it "has a resource name of :ksh" do
31
+ expect(resource.resource_name).to eql(:ksh)
34
32
  end
35
33
 
36
- it "should have an interpreter of ksh" do
37
- expect(@resource.interpreter).to eql("ksh")
34
+ it "has an interpreter of ksh" do
35
+ expect(resource.interpreter).to eql("ksh")
38
36
  end
39
37
 
40
38
  end
@@ -1,29 +1,36 @@
1
1
  #
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+ #
2
14
 
3
15
  require "spec_helper"
4
16
 
5
17
  describe Chef::Resource::Launchd do
6
- @launchd = Chef::Resource::Launchd.new("io.chef.chef-client")
7
- let(:resource) do
8
- Chef::Resource::Launchd.new(
9
- "io.chef.chef-client",
10
- run_context
11
- ) end
18
+ let(:resource) { Chef::Resource::Launchd.new("io.chef.chef-client" ) }
12
19
 
13
- it "should create a new Chef::Resource::Launchd" do
20
+ it "creates a new Chef::Resource::Launchd" do
14
21
  expect(resource).to be_a_kind_of(Chef::Resource)
15
22
  expect(resource).to be_a_kind_of(Chef::Resource::Launchd)
16
23
  end
17
24
 
18
- it "should have a resource name of Launchd" do
25
+ it "has a resource name of Launchd" do
19
26
  expect(resource.resource_name).to eql(:launchd)
20
27
  end
21
28
 
22
- it "should have a default action of create" do
29
+ it "has a default action of create" do
23
30
  expect(resource.action).to eql([:create])
24
31
  end
25
32
 
26
- it "should accept enable, disable, create, and delete as actions" do
33
+ it "accepts enable, disable, create, and delete as actions" do
27
34
  expect { resource.action :enable }.not_to raise_error
28
35
  expect { resource.action :disable }.not_to raise_error
29
36
  expect { resource.action :create }.not_to raise_error
@@ -20,115 +20,115 @@
20
20
  require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::Link do
23
+ let(:resource) { Chef::Resource::Link.new("fakey_fakerton") }
23
24
 
24
25
  before(:each) do
25
26
  expect_any_instance_of(Chef::Resource::Link).to receive(:verify_links_supported!).and_return(true)
26
- @resource = Chef::Resource::Link.new("fakey_fakerton")
27
27
  end
28
28
 
29
- it "should create a new Chef::Resource::Link" do
30
- expect(@resource).to be_a_kind_of(Chef::Resource)
31
- expect(@resource).to be_a_kind_of(Chef::Resource::Link)
29
+ it "creates a new Chef::Resource::Link" do
30
+ expect(resource).to be_a_kind_of(Chef::Resource)
31
+ expect(resource).to be_a_kind_of(Chef::Resource::Link)
32
32
  end
33
33
 
34
- it "should have a name" do
35
- expect(@resource.name).to eql("fakey_fakerton")
34
+ it "has a name" do
35
+ expect(resource.name).to eql("fakey_fakerton")
36
36
  end
37
37
 
38
- it "should have a default action of 'create'" do
39
- expect(@resource.action).to eql([:create])
38
+ it "has a default action of 'create'" do
39
+ expect(resource.action).to eql([:create])
40
40
  end
41
41
 
42
42
  { :create => false, :delete => false, :blues => true }.each do |action, bad_value|
43
43
  it "should #{bad_value ? 'not' : ''} accept #{action}" do
44
44
  if bad_value
45
- expect { @resource.action action }.to raise_error(ArgumentError)
45
+ expect { resource.action action }.to raise_error(ArgumentError)
46
46
  else
47
- expect { @resource.action action }.not_to raise_error
47
+ expect { resource.action action }.not_to raise_error
48
48
  end
49
49
  end
50
50
  end
51
51
 
52
- it "should use the object name as the target_file by default" do
53
- expect(@resource.target_file).to eql("fakey_fakerton")
52
+ it "uses the object name as the target_file by default" do
53
+ expect(resource.target_file).to eql("fakey_fakerton")
54
54
  end
55
55
 
56
- it "should accept a delayed evaluator as the target path" do
57
- @resource.target_file Chef::DelayedEvaluator.new { "my_lazy_name" }
58
- expect(@resource.target_file).to eql("my_lazy_name")
56
+ it "accepts a delayed evaluator as the target path" do
57
+ resource.target_file Chef::DelayedEvaluator.new { "my_lazy_name" }
58
+ expect(resource.target_file).to eql("my_lazy_name")
59
59
  end
60
60
 
61
- it "should accept a delayed evaluator when accessing via 'path'" do
62
- @resource.target_file Chef::DelayedEvaluator.new { "my_lazy_name" }
63
- expect(@resource.path).to eql("my_lazy_name")
61
+ it "accepts a delayed evaluator when accessing via 'path'" do
62
+ resource.target_file Chef::DelayedEvaluator.new { "my_lazy_name" }
63
+ expect(resource.path).to eql("my_lazy_name")
64
64
  end
65
65
 
66
- it "should accept a delayed evaluator via 'to'" do
67
- @resource.to Chef::DelayedEvaluator.new { "my_lazy_name" }
68
- expect(@resource.to).to eql("my_lazy_name")
66
+ it "accepts a delayed evaluator via 'to'" do
67
+ resource.to Chef::DelayedEvaluator.new { "my_lazy_name" }
68
+ expect(resource.to).to eql("my_lazy_name")
69
69
  end
70
70
 
71
- it "should accept a string as the link source via 'to'" do
72
- expect { @resource.to "/tmp" }.not_to raise_error
71
+ it "accepts a string as the link source via 'to'" do
72
+ expect { resource.to "/tmp" }.not_to raise_error
73
73
  end
74
74
 
75
- it "should not accept a Hash for the link source via 'to'" do
76
- expect { @resource.to Hash.new }.to raise_error(ArgumentError)
75
+ it "does not accept a Hash for the link source via 'to'" do
76
+ expect { resource.to Hash.new }.to raise_error(ArgumentError)
77
77
  end
78
78
 
79
- it "should allow you to set a link source via 'to'" do
80
- @resource.to "/tmp/foo"
81
- expect(@resource.to).to eql("/tmp/foo")
79
+ it "allows you to set a link source via 'to'" do
80
+ resource.to "/tmp/foo"
81
+ expect(resource.to).to eql("/tmp/foo")
82
82
  end
83
83
 
84
- it "should allow you to specify the link type" do
85
- @resource.link_type "symbolic"
86
- expect(@resource.link_type).to eql(:symbolic)
84
+ it "allows you to specify the link type" do
85
+ resource.link_type "symbolic"
86
+ expect(resource.link_type).to eql(:symbolic)
87
87
  end
88
88
 
89
- it "should default to a symbolic link" do
90
- expect(@resource.link_type).to eql(:symbolic)
89
+ it "defaults to a symbolic link" do
90
+ expect(resource.link_type).to eql(:symbolic)
91
91
  end
92
92
 
93
- it "should accept a hard link_type" do
94
- @resource.link_type :hard
95
- expect(@resource.link_type).to eql(:hard)
93
+ it "accepts a hard link_type" do
94
+ resource.link_type :hard
95
+ expect(resource.link_type).to eql(:hard)
96
96
  end
97
97
 
98
- it "should reject any other link_type but :hard and :symbolic" do
99
- expect { @resource.link_type "x-men" }.to raise_error(ArgumentError)
98
+ it "rejects any other link_type but :hard and :symbolic" do
99
+ expect { resource.link_type "x-men" }.to raise_error(ArgumentError)
100
100
  end
101
101
 
102
- it "should accept a group name or id for group" do
103
- expect { @resource.group "root" }.not_to raise_error
104
- expect { @resource.group 123 }.not_to raise_error
105
- expect { @resource.group "root:goo" }.to raise_error(ArgumentError)
102
+ it "accepts a group name or id for group" do
103
+ expect { resource.group "root" }.not_to raise_error
104
+ expect { resource.group 123 }.not_to raise_error
105
+ expect { resource.group "root:goo" }.to raise_error(ArgumentError)
106
106
  end
107
107
 
108
- it "should accept a user name or id for owner" do
109
- expect { @resource.owner "root" }.not_to raise_error
110
- expect { @resource.owner 123 }.not_to raise_error
111
- expect { @resource.owner "root:goo" }.to raise_error(ArgumentError)
108
+ it "accepts a user name or id for owner" do
109
+ expect { resource.owner "root" }.not_to raise_error
110
+ expect { resource.owner 123 }.not_to raise_error
111
+ expect { resource.owner "root:goo" }.to raise_error(ArgumentError)
112
112
  end
113
113
 
114
114
  describe "when it has to, link_type, owner, and group" do
115
115
  before do
116
- @resource.target_file("/var/target.tar")
117
- @resource.to("/to/dir/file.tar")
118
- @resource.link_type(:symbolic)
119
- @resource.owner("root")
120
- @resource.group("0664")
116
+ resource.target_file("/var/target.tar")
117
+ resource.to("/to/dir/file.tar")
118
+ resource.link_type(:symbolic)
119
+ resource.owner("root")
120
+ resource.group("0664")
121
121
  end
122
122
 
123
123
  it "describes its state" do
124
- state = @resource.state_for_resource_reporter
124
+ state = resource.state_for_resource_reporter
125
125
  expect(state[:to]).to eq("/to/dir/file.tar")
126
126
  expect(state[:owner]).to eq("root")
127
127
  expect(state[:group]).to eq("0664")
128
128
  end
129
129
 
130
130
  it "returns the target file as its identity" do
131
- expect(@resource.identity).to eq("/var/target.tar")
131
+ expect(resource.identity).to eq("/var/target.tar")
132
132
  end
133
133
  end
134
134
  end