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
@@ -21,87 +21,85 @@ require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::Route do
23
23
 
24
- before(:each) do
25
- @resource = Chef::Resource::Route.new("10.0.0.10")
26
- end
24
+ let(:resource) { Chef::Resource::Route.new("10.0.0.10") }
27
25
 
28
- it "should create a new Chef::Resource::Route" do
29
- expect(@resource).to be_a_kind_of(Chef::Resource)
30
- expect(@resource).to be_a_kind_of(Chef::Resource::Route)
26
+ it "creates a new Chef::Resource::Route" do
27
+ expect(resource).to be_a_kind_of(Chef::Resource)
28
+ expect(resource).to be_a_kind_of(Chef::Resource::Route)
31
29
  end
32
30
 
33
- it "should have a name" do
34
- expect(@resource.name).to eql("10.0.0.10")
31
+ it "has a name" do
32
+ expect(resource.name).to eql("10.0.0.10")
35
33
  end
36
34
 
37
- it "should have a default action of 'add'" do
38
- expect(@resource.action).to eql([:add])
35
+ it "has a default action of 'add'" do
36
+ expect(resource.action).to eql([:add])
39
37
  end
40
38
 
41
- it "should accept add or delete for action" do
42
- expect { @resource.action :add }.not_to raise_error
43
- expect { @resource.action :delete }.not_to raise_error
44
- expect { @resource.action :lolcat }.to raise_error(ArgumentError)
39
+ it "accepts add or delete for action" do
40
+ expect { resource.action :add }.not_to raise_error
41
+ expect { resource.action :delete }.not_to raise_error
42
+ expect { resource.action :lolcat }.to raise_error(ArgumentError)
45
43
  end
46
44
 
47
- it "should use the object name as the target by default" do
48
- expect(@resource.target).to eql("10.0.0.10")
45
+ it "uses the object name as the target by default" do
46
+ expect(resource.target).to eql("10.0.0.10")
49
47
  end
50
48
 
51
- it "should allow you to specify the netmask" do
52
- @resource.netmask "255.255.255.0"
53
- expect(@resource.netmask).to eql("255.255.255.0")
49
+ it "allows you to specify the netmask" do
50
+ resource.netmask "255.255.255.0"
51
+ expect(resource.netmask).to eql("255.255.255.0")
54
52
  end
55
53
 
56
- it "should allow you to specify the gateway" do
57
- @resource.gateway "10.0.0.1"
58
- expect(@resource.gateway).to eql("10.0.0.1")
54
+ it "allows you to specify the gateway" do
55
+ resource.gateway "10.0.0.1"
56
+ expect(resource.gateway).to eql("10.0.0.1")
59
57
  end
60
58
 
61
- it "should allow you to specify the metric" do
62
- @resource.metric 10
63
- expect(@resource.metric).to eql(10)
59
+ it "allows you to specify the metric" do
60
+ resource.metric 10
61
+ expect(resource.metric).to eql(10)
64
62
  end
65
63
 
66
- it "should allow you to specify the device" do
67
- @resource.device "eth0"
68
- expect(@resource.device).to eql("eth0")
64
+ it "allows you to specify the device" do
65
+ resource.device "eth0"
66
+ expect(resource.device).to eql("eth0")
69
67
  end
70
68
 
71
- it "should allow you to specify the route type" do
72
- @resource.route_type "host"
73
- expect(@resource.route_type).to eql(:host)
69
+ it "allows you to specify the route type" do
70
+ resource.route_type "host"
71
+ expect(resource.route_type).to eql(:host)
74
72
  end
75
73
 
76
- it "should default to a host route type" do
77
- expect(@resource.route_type).to eql(:host)
74
+ it "defaults to a host route type" do
75
+ expect(resource.route_type).to eql(:host)
78
76
  end
79
77
 
80
- it "should accept a net route type" do
81
- @resource.route_type :net
82
- expect(@resource.route_type).to eql(:net)
78
+ it "accepts a net route type" do
79
+ resource.route_type :net
80
+ expect(resource.route_type).to eql(:net)
83
81
  end
84
82
 
85
- it "should reject any other route_type but :host and :net" do
86
- expect { @resource.route_type "lolcat" }.to raise_error(ArgumentError)
83
+ it "rejects any other route_type but :host and :net" do
84
+ expect { resource.route_type "lolcat" }.to raise_error(ArgumentError)
87
85
  end
88
86
 
89
87
  describe "when it has netmask, gateway, and device" do
90
88
  before do
91
- @resource.target("charmander")
92
- @resource.netmask("lemask")
93
- @resource.gateway("111.111.111")
94
- @resource.device("forcefield")
89
+ resource.target("charmander")
90
+ resource.netmask("lemask")
91
+ resource.gateway("111.111.111")
92
+ resource.device("forcefield")
95
93
  end
96
94
 
97
95
  it "describes its state" do
98
- state = @resource.state_for_resource_reporter
96
+ state = resource.state_for_resource_reporter
99
97
  expect(state[:netmask]).to eq("lemask")
100
98
  expect(state[:gateway]).to eq("111.111.111")
101
99
  end
102
100
 
103
101
  it "returns the target as its identity" do
104
- expect(@resource.identity).to eq("charmander")
102
+ expect(resource.identity).to eq("charmander")
105
103
  end
106
104
  end
107
105
  end
@@ -34,13 +34,11 @@ describe Chef::Resource::RpmPackage, "initialize" do
34
34
  end
35
35
 
36
36
  describe Chef::Resource::RpmPackage, "allow_downgrade" do
37
- before(:each) do
38
- @resource = Chef::Resource::RpmPackage.new("foo")
39
- end
37
+ let(:resource) { Chef::Resource::RpmPackage.new("foo") }
40
38
 
41
- it "should allow you to specify whether allow_downgrade is true or false" do
42
- expect { @resource.allow_downgrade true }.not_to raise_error
43
- expect { @resource.allow_downgrade false }.not_to raise_error
44
- expect { @resource.allow_downgrade "monkey" }.to raise_error(ArgumentError)
39
+ it "allows you to specify whether allow_downgrade is true or false" do
40
+ expect { resource.allow_downgrade true }.not_to raise_error
41
+ expect { resource.allow_downgrade false }.not_to raise_error
42
+ expect { resource.allow_downgrade "monkey" }.to raise_error(ArgumentError)
45
43
  end
46
44
  end
@@ -21,41 +21,39 @@ require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::RubyBlock do
23
23
 
24
- before(:each) do
25
- @resource = Chef::Resource::RubyBlock.new("fakey_fakerton")
26
- end
24
+ let(:resource) { Chef::Resource::RubyBlock.new("fakey_fakerton") }
27
25
 
28
- it "should create a new Chef::Resource::RubyBlock" do
29
- expect(@resource).to be_a_kind_of(Chef::Resource)
30
- expect(@resource).to be_a_kind_of(Chef::Resource::RubyBlock)
26
+ it "creates a new Chef::Resource::RubyBlock" do
27
+ expect(resource).to be_a_kind_of(Chef::Resource)
28
+ expect(resource).to be_a_kind_of(Chef::Resource::RubyBlock)
31
29
  end
32
30
 
33
- it "should have a default action of 'run'" do
34
- expect(@resource.action).to eql([:run])
31
+ it "has a default action of 'run'" do
32
+ expect(resource.action).to eql([:run])
35
33
  end
36
34
 
37
- it "should have a resource name of :ruby_block" do
38
- expect(@resource.resource_name).to eql(:ruby_block)
35
+ it "has a resource name of :ruby_block" do
36
+ expect(resource.resource_name).to eql(:ruby_block)
39
37
  end
40
38
 
41
- it "should accept a ruby block/proc/.. for the 'block' parameter" do
42
- expect(@resource.block do
39
+ it "accepts a ruby block/proc/.. for the 'block' parameter" do
40
+ expect(resource.block do
43
41
  "foo"
44
42
  end.call).to eql("foo")
45
43
  end
46
44
 
47
45
  it "allows the action to be 'create'" do
48
- @resource.action :create
49
- expect(@resource.action).to eq([:create])
46
+ resource.action :create
47
+ expect(resource.action).to eq([:create])
50
48
  end
51
49
 
52
50
  describe "when it has been initialized with block code" do
53
51
  before do
54
- @resource.block_name("puts 'harrrr'")
52
+ resource.block_name("puts 'harrrr'")
55
53
  end
56
54
 
57
55
  it "returns the block as its identity" do
58
- expect(@resource.identity).to eq("puts 'harrrr'")
56
+ expect(resource.identity).to eq("puts 'harrrr'")
59
57
  end
60
58
  end
61
59
  end
@@ -19,22 +19,18 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Chef::Resource::Ruby do
22
+ let(:resource) { Chef::Resource::Ruby.new("fakey_fakerton") }
22
23
 
23
- before(:each) do
24
- @resource = Chef::Resource::Ruby.new("fakey_fakerton")
24
+ it "creates a new Chef::Resource::Ruby" do
25
+ expect(resource).to be_a_kind_of(Chef::Resource)
26
+ expect(resource).to be_a_kind_of(Chef::Resource::Ruby)
25
27
  end
26
28
 
27
- it "should create a new Chef::Resource::Ruby" do
28
- expect(@resource).to be_a_kind_of(Chef::Resource)
29
- expect(@resource).to be_a_kind_of(Chef::Resource::Ruby)
29
+ it "has a resource name of :ruby" do
30
+ expect(resource.resource_name).to eql(:ruby)
30
31
  end
31
32
 
32
- it "should have a resource name of :ruby" do
33
- expect(@resource.resource_name).to eql(:ruby)
33
+ it "has an interpreter of ruby" do
34
+ expect(resource.interpreter).to eql("ruby")
34
35
  end
35
-
36
- it "should have an interpreter of ruby" do
37
- expect(@resource.interpreter).to eql("ruby")
38
- end
39
-
40
36
  end
@@ -20,174 +20,171 @@
20
20
  require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::Scm do
23
+ let(:resource) { Chef::Resource::Scm.new("my awesome app") }
23
24
 
24
- before(:each) do
25
- @resource = Chef::Resource::Scm.new("my awesome app")
26
- end
27
-
28
- it "should be a SCM resource" do
29
- expect(@resource).to be_a_kind_of(Chef::Resource::Scm)
25
+ it "is a SCM resource" do
26
+ expect(resource).to be_a_kind_of(Chef::Resource::Scm)
30
27
  end
31
28
 
32
29
  it "supports :checkout, :export, :sync, :diff, and :log actions" do
33
- expect(@resource.allowed_actions).to include(:checkout)
34
- expect(@resource.allowed_actions).to include(:export)
35
- expect(@resource.allowed_actions).to include(:sync)
36
- expect(@resource.allowed_actions).to include(:diff)
37
- expect(@resource.allowed_actions).to include(:log)
30
+ expect(resource.allowed_actions).to include(:checkout)
31
+ expect(resource.allowed_actions).to include(:export)
32
+ expect(resource.allowed_actions).to include(:sync)
33
+ expect(resource.allowed_actions).to include(:diff)
34
+ expect(resource.allowed_actions).to include(:log)
38
35
  end
39
36
 
40
37
  it "takes the destination path as a string" do
41
- @resource.destination "/path/to/deploy/dir"
42
- expect(@resource.destination).to eql("/path/to/deploy/dir")
38
+ resource.destination "/path/to/deploy/dir"
39
+ expect(resource.destination).to eql("/path/to/deploy/dir")
43
40
  end
44
41
 
45
42
  it "takes a string for the repository URL" do
46
- @resource.repository "git://github.com/opscode/chef.git"
47
- expect(@resource.repository).to eql("git://github.com/opscode/chef.git")
43
+ resource.repository "git://github.com/opscode/chef.git"
44
+ expect(resource.repository).to eql("git://github.com/opscode/chef.git")
48
45
  end
49
46
 
50
47
  it "takes a string for the revision" do
51
- @resource.revision "abcdef"
52
- expect(@resource.revision).to eql("abcdef")
48
+ resource.revision "abcdef"
49
+ expect(resource.revision).to eql("abcdef")
53
50
  end
54
51
 
55
52
  it "defaults to the ``HEAD'' revision" do
56
- expect(@resource.revision).to eql("HEAD")
53
+ expect(resource.revision).to eql("HEAD")
57
54
  end
58
55
 
59
56
  it "takes a string for the user to run as" do
60
- @resource.user "dr_deploy"
61
- expect(@resource.user).to eql("dr_deploy")
57
+ resource.user "dr_deploy"
58
+ expect(resource.user).to eql("dr_deploy")
62
59
  end
63
60
 
64
61
  it "also takes an integer for the user to run as" do
65
- @resource.user 0
66
- expect(@resource.user).to eql(0)
62
+ resource.user 0
63
+ expect(resource.user).to eql(0)
67
64
  end
68
65
 
69
66
  it "takes a string for the group to run as, defaulting to nil" do
70
- expect(@resource.group).to be_nil
71
- @resource.group "opsdevs"
72
- expect(@resource.group).to eq("opsdevs")
67
+ expect(resource.group).to be_nil
68
+ resource.group "opsdevs"
69
+ expect(resource.group).to eq("opsdevs")
73
70
  end
74
71
 
75
72
  it "also takes an integer for the group to run as" do
76
- @resource.group 23
77
- expect(@resource.group).to eq(23)
73
+ resource.group 23
74
+ expect(resource.group).to eq(23)
78
75
  end
79
76
 
80
77
  it "has a svn_username String attribute" do
81
- @resource.svn_username "moartestsplz"
82
- expect(@resource.svn_username).to eql("moartestsplz")
78
+ resource.svn_username "moartestsplz"
79
+ expect(resource.svn_username).to eql("moartestsplz")
83
80
  end
84
81
 
85
82
  it "has a svn_password String attribute" do
86
- @resource.svn_password "taftplz"
87
- expect(@resource.svn_password).to eql("taftplz")
83
+ resource.svn_password "taftplz"
84
+ expect(resource.svn_password).to eql("taftplz")
88
85
  end
89
86
 
90
87
  it "has a svn_arguments String attribute" do
91
- @resource.svn_arguments "--more-taft plz"
92
- expect(@resource.svn_arguments).to eql("--more-taft plz")
88
+ resource.svn_arguments "--more-taft plz"
89
+ expect(resource.svn_arguments).to eql("--more-taft plz")
93
90
  end
94
91
 
95
92
  it "has a svn_info_args String attribute" do
96
- expect(@resource.svn_info_args).to be_nil
97
- @resource.svn_info_args("--no-moar-plaintext-creds yep")
98
- expect(@resource.svn_info_args).to eq("--no-moar-plaintext-creds yep")
93
+ expect(resource.svn_info_args).to be_nil
94
+ resource.svn_info_args("--no-moar-plaintext-creds yep")
95
+ expect(resource.svn_info_args).to eq("--no-moar-plaintext-creds yep")
99
96
  end
100
97
 
101
98
  it "takes the depth as an integer for shallow clones" do
102
- @resource.depth 5
103
- expect(@resource.depth).to eq(5)
104
- expect { @resource.depth "five" }.to raise_error(ArgumentError)
99
+ resource.depth 5
100
+ expect(resource.depth).to eq(5)
101
+ expect { resource.depth "five" }.to raise_error(ArgumentError)
105
102
  end
106
103
 
107
104
  it "defaults to nil depth for a full clone" do
108
- expect(@resource.depth).to be_nil
105
+ expect(resource.depth).to be_nil
109
106
  end
110
107
 
111
108
  it "takes a boolean for #enable_submodules" do
112
- @resource.enable_submodules true
113
- expect(@resource.enable_submodules).to be_truthy
114
- expect { @resource.enable_submodules "lolz" }.to raise_error(ArgumentError)
109
+ resource.enable_submodules true
110
+ expect(resource.enable_submodules).to be_truthy
111
+ expect { resource.enable_submodules "lolz" }.to raise_error(ArgumentError)
115
112
  end
116
113
 
117
114
  it "defaults to not enabling submodules" do
118
- expect(@resource.enable_submodules).to be_falsey
115
+ expect(resource.enable_submodules).to be_falsey
119
116
  end
120
117
 
121
118
  it "takes a boolean for #enable_checkout" do
122
- @resource.enable_checkout true
123
- expect(@resource.enable_checkout).to be_truthy
124
- expect { @resource.enable_checkout "lolz" }.to raise_error(ArgumentError)
119
+ resource.enable_checkout true
120
+ expect(resource.enable_checkout).to be_truthy
121
+ expect { resource.enable_checkout "lolz" }.to raise_error(ArgumentError)
125
122
  end
126
123
 
127
124
  it "defaults to enabling checkout" do
128
- expect(@resource.enable_checkout).to be_truthy
125
+ expect(resource.enable_checkout).to be_truthy
129
126
  end
130
127
 
131
128
  it "takes a string for the remote" do
132
- @resource.remote "opscode"
133
- expect(@resource.remote).to eql("opscode")
134
- expect { @resource.remote 1337 }.to raise_error(ArgumentError)
129
+ resource.remote "opscode"
130
+ expect(resource.remote).to eql("opscode")
131
+ expect { resource.remote 1337 }.to raise_error(ArgumentError)
135
132
  end
136
133
 
137
134
  it "defaults to ``origin'' for the remote" do
138
- expect(@resource.remote).to eq("origin")
135
+ expect(resource.remote).to eq("origin")
139
136
  end
140
137
 
141
138
  it "takes a string for the ssh wrapper" do
142
- @resource.ssh_wrapper "with_ssh_fu"
143
- expect(@resource.ssh_wrapper).to eql("with_ssh_fu")
139
+ resource.ssh_wrapper "with_ssh_fu"
140
+ expect(resource.ssh_wrapper).to eql("with_ssh_fu")
144
141
  end
145
142
 
146
143
  it "defaults to nil for the ssh wrapper" do
147
- expect(@resource.ssh_wrapper).to be_nil
144
+ expect(resource.ssh_wrapper).to be_nil
148
145
  end
149
146
 
150
147
  it "defaults to nil for the environment" do
151
- expect(@resource.environment).to be_nil
148
+ expect(resource.environment).to be_nil
152
149
  end
153
150
 
154
151
  describe "when it has a timeout attribute" do
155
152
  let(:ten_seconds) { 10 }
156
- before { @resource.timeout(ten_seconds) }
153
+ before { resource.timeout(ten_seconds) }
157
154
  it "stores this timeout" do
158
- expect(@resource.timeout).to eq(ten_seconds)
155
+ expect(resource.timeout).to eq(ten_seconds)
159
156
  end
160
157
  end
161
158
  describe "when it has no timeout attribute" do
162
- it "should have no default timeout" do
163
- expect(@resource.timeout).to be_nil
159
+ it "has no default timeout" do
160
+ expect(resource.timeout).to be_nil
164
161
  end
165
162
  end
166
163
 
167
164
  describe "when it has repository, revision, user, and group" do
168
165
  before do
169
- @resource.destination("hell")
170
- @resource.repository("apt")
171
- @resource.revision("1.2.3")
172
- @resource.user("root")
173
- @resource.group("super_adventure_club")
166
+ resource.destination("hell")
167
+ resource.repository("apt")
168
+ resource.revision("1.2.3")
169
+ resource.user("root")
170
+ resource.group("super_adventure_club")
174
171
  end
175
172
 
176
173
  it "describes its state" do
177
- state = @resource.state_for_resource_reporter
174
+ state = resource.state_for_resource_reporter
178
175
  expect(state[:revision]).to eq("1.2.3")
179
176
  end
180
177
 
181
178
  it "returns the destination as its identity" do
182
- expect(@resource.identity).to eq("hell")
179
+ expect(resource.identity).to eq("hell")
183
180
  end
184
181
  end
185
182
 
186
183
  describe "when it has a environment attribute" do
187
184
  let(:test_environment) { { "CHEF_ENV" => "/tmp" } }
188
- before { @resource.environment(test_environment) }
185
+ before { resource.environment(test_environment) }
189
186
  it "stores this environment" do
190
- expect(@resource.environment).to eq(test_environment)
187
+ expect(resource.environment).to eq(test_environment)
191
188
  end
192
189
  end
193
190
  end