chef 13.6.4 → 13.7.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  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 +6 -6
  256. data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
  257. data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
@@ -21,53 +21,49 @@ require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::Log do
23
23
 
24
- before(:each) do
25
- @log_str = "this is my string to log"
26
- @resource = Chef::Resource::Log.new(@log_str)
27
- end
24
+ let(:log_str) { "this is my string to log" }
25
+ let(:resource) { Chef::Resource::Log.new(log_str) }
28
26
 
29
- it "should create a new Chef::Resource::Log" do
30
- expect(@resource).to be_a_kind_of(Chef::Resource)
31
- expect(@resource).to be_a_kind_of(Chef::Resource::Log)
27
+ it "creates a new Chef::Resource::Log" do
28
+ expect(resource).to be_a_kind_of(Chef::Resource)
29
+ expect(resource).to be_a_kind_of(Chef::Resource::Log)
32
30
  end
33
31
 
34
32
  it "supports the :write actions" do
35
- expect(@resource.allowed_actions).to include(:write)
33
+ expect(resource.allowed_actions).to include(:write)
36
34
  end
37
35
 
38
- it "should have a name of log" do
39
- expect(@resource.resource_name).to eq(:log)
36
+ it "has a name of log" do
37
+ expect(resource.resource_name).to eq(:log)
40
38
  end
41
39
 
42
- it "should allow you to set a log string" do
43
- expect(@resource.name).to eq(@log_str)
40
+ it "allows you to set a log string" do
41
+ expect(resource.name).to eq(log_str)
44
42
  end
45
43
 
46
- it "should set the message to the first argument to new" do
47
- expect(@resource.message).to eq(@log_str)
44
+ it "sets the message to the first argument to new" do
45
+ expect(resource.message).to eq(log_str)
48
46
  end
49
47
 
50
- it "should accept a string for the log message" do
51
- @resource.message "this is different"
52
- expect(@resource.message).to eq("this is different")
48
+ it "accepts a string for the log message" do
49
+ resource.message "this is different"
50
+ expect(resource.message).to eq("this is different")
53
51
  end
54
52
 
55
- it "should accept a vaild level option" do
56
- @resource.level :debug
57
- @resource.level :info
58
- @resource.level :warn
59
- @resource.level :error
60
- @resource.level :fatal
61
- expect { @resource.level :unsupported }.to raise_error(ArgumentError)
53
+ it "accepts a vaild level option" do
54
+ resource.level :debug
55
+ resource.level :info
56
+ resource.level :warn
57
+ resource.level :error
58
+ resource.level :fatal
59
+ expect { resource.level :unsupported }.to raise_error(ArgumentError)
62
60
  end
63
61
 
64
62
  describe "when the identity is defined" do
65
- before do
66
- @resource = Chef::Resource::Log.new("ery day I'm loggin-in")
67
- end
63
+ let(:resource) { Chef::Resource::Log.new("ery day I'm loggin-in") }
68
64
 
69
65
  it "returns the log string as its identity" do
70
- expect(@resource.identity).to eq("ery day I'm loggin-in")
66
+ expect(resource.identity).to eq("ery day I'm loggin-in")
71
67
  end
72
68
  end
73
69
  end
@@ -21,86 +21,84 @@ require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::Mdadm do
23
23
 
24
- before(:each) do
25
- @resource = Chef::Resource::Mdadm.new("fakey_fakerton")
26
- end
24
+ let(:resource) { Chef::Resource::Mdadm.new("fakey_fakerton") }
27
25
 
28
- it "should create a new Chef::Resource::Mdadm" do
29
- expect(@resource).to be_a_kind_of(Chef::Resource)
30
- expect(@resource).to be_a_kind_of(Chef::Resource::Mdadm)
26
+ it "creates a new Chef::Resource::Mdadm" do
27
+ expect(resource).to be_a_kind_of(Chef::Resource)
28
+ expect(resource).to be_a_kind_of(Chef::Resource::Mdadm)
31
29
  end
32
30
 
33
- it "should have a resource name of :mdadm" do
34
- expect(@resource.resource_name).to eql(:mdadm)
31
+ it "has a resource name of :mdadm" do
32
+ expect(resource.resource_name).to eql(:mdadm)
35
33
  end
36
34
 
37
- it "should have a default action of create" do
38
- expect(@resource.action).to eql([:create])
35
+ it "has a default action of create" do
36
+ expect(resource.action).to eql([:create])
39
37
  end
40
38
 
41
- it "should accept create, assemble, stop as actions" do
42
- expect { @resource.action :create }.not_to raise_error
43
- expect { @resource.action :assemble }.not_to raise_error
44
- expect { @resource.action :stop }.not_to raise_error
39
+ it "accepts create, assemble, stop as actions" do
40
+ expect { resource.action :create }.not_to raise_error
41
+ expect { resource.action :assemble }.not_to raise_error
42
+ expect { resource.action :stop }.not_to raise_error
45
43
  end
46
44
 
47
- it "should allow you to set the raid_device attribute" do
48
- @resource.raid_device "/dev/md3"
49
- expect(@resource.raid_device).to eql("/dev/md3")
45
+ it "allows you to set the raid_device attribute" do
46
+ resource.raid_device "/dev/md3"
47
+ expect(resource.raid_device).to eql("/dev/md3")
50
48
  end
51
49
 
52
- it "should allow you to set the chunk attribute" do
53
- @resource.chunk 256
54
- expect(@resource.chunk).to eql(256)
50
+ it "allows you to set the chunk attribute" do
51
+ resource.chunk 256
52
+ expect(resource.chunk).to eql(256)
55
53
  end
56
54
 
57
- it "should allow you to set the level attribute" do
58
- @resource.level 1
59
- expect(@resource.level).to eql(1)
55
+ it "allows you to set the level attribute" do
56
+ resource.level 1
57
+ expect(resource.level).to eql(1)
60
58
  end
61
59
 
62
- it "should allow you to set the metadata attribute" do
63
- @resource.metadata "1.2"
64
- expect(@resource.metadata).to eql("1.2")
60
+ it "allows you to set the metadata attribute" do
61
+ resource.metadata "1.2"
62
+ expect(resource.metadata).to eql("1.2")
65
63
  end
66
64
 
67
- it "should allow you to set the bitmap attribute" do
68
- @resource.bitmap "internal"
69
- expect(@resource.bitmap).to eql("internal")
65
+ it "allows you to set the bitmap attribute" do
66
+ resource.bitmap "internal"
67
+ expect(resource.bitmap).to eql("internal")
70
68
  end
71
69
 
72
- it "should allow you to set the layout attribute" do
73
- @resource.layout "f2"
74
- expect(@resource.layout).to eql("f2")
70
+ it "allows you to set the layout attribute" do
71
+ resource.layout "f2"
72
+ expect(resource.layout).to eql("f2")
75
73
  end
76
74
 
77
- it "should allow you to set the devices attribute" do
78
- @resource.devices ["/dev/sda", "/dev/sdb"]
79
- expect(@resource.devices).to eql(["/dev/sda", "/dev/sdb"])
75
+ it "allows you to set the devices attribute" do
76
+ resource.devices ["/dev/sda", "/dev/sdb"]
77
+ expect(resource.devices).to eql(["/dev/sda", "/dev/sdb"])
80
78
  end
81
79
 
82
- it "should allow you to set the exists attribute" do
83
- @resource.exists true
84
- expect(@resource.exists).to eql(true)
80
+ it "allows you to set the exists attribute" do
81
+ resource.exists true
82
+ expect(resource.exists).to eql(true)
85
83
  end
86
84
 
87
85
  describe "when it has devices, level, and chunk" do
88
86
  before do
89
- @resource.raid_device("raider")
90
- @resource.devices(%w{device1 device2})
91
- @resource.level(1)
92
- @resource.chunk(42)
87
+ resource.raid_device("raider")
88
+ resource.devices(%w{device1 device2})
89
+ resource.level(1)
90
+ resource.chunk(42)
93
91
  end
94
92
 
95
93
  it "describes its state" do
96
- state = @resource.state_for_resource_reporter
94
+ state = resource.state_for_resource_reporter
97
95
  expect(state[:devices]).to eql(%w{device1 device2})
98
96
  expect(state[:level]).to eq(1)
99
97
  expect(state[:chunk]).to eq(42)
100
98
  end
101
99
 
102
100
  it "returns the raid device as its identity" do
103
- expect(@resource.identity).to eq("raider")
101
+ expect(resource.identity).to eq("raider")
104
102
  end
105
103
  end
106
104
 
@@ -20,189 +20,187 @@
20
20
  require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::Mount do
23
- before(:each) do
24
- @resource = Chef::Resource::Mount.new("filesystem")
25
- end
23
+ let(:resource) { Chef::Resource::Mount.new("filesystem") }
26
24
 
27
- it "should create a new Chef::Resource::Mount" do
28
- expect(@resource).to be_a_kind_of(Chef::Resource)
29
- expect(@resource).to be_a_kind_of(Chef::Resource::Mount)
25
+ it "creates a new Chef::Resource::Mount" do
26
+ expect(resource).to be_a_kind_of(Chef::Resource)
27
+ expect(resource).to be_a_kind_of(Chef::Resource::Mount)
30
28
  end
31
29
 
32
- it "should have a name" do
33
- expect(@resource.name).to eql("filesystem")
30
+ it "has a name" do
31
+ expect(resource.name).to eql("filesystem")
34
32
  end
35
33
 
36
- it "should set mount_point to the name" do
37
- expect(@resource.mount_point).to eql("filesystem")
34
+ it "sets mount_point to the name" do
35
+ expect(resource.mount_point).to eql("filesystem")
38
36
  end
39
37
 
40
- it "should have a default action of mount" do
41
- expect(@resource.action).to eql([:mount])
38
+ it "has a default action of mount" do
39
+ expect(resource.action).to eql([:mount])
42
40
  end
43
41
 
44
- it "should accept mount, umount, unmount and remount as actions" do
45
- expect { @resource.action :mount }.not_to raise_error
46
- expect { @resource.action :umount }.not_to raise_error
47
- expect { @resource.action :unmount }.not_to raise_error
48
- expect { @resource.action :remount }.not_to raise_error
49
- expect { @resource.action :brooklyn }.to raise_error(ArgumentError)
42
+ it "accepts mount, umount, unmount and remount as actions" do
43
+ expect { resource.action :mount }.not_to raise_error
44
+ expect { resource.action :umount }.not_to raise_error
45
+ expect { resource.action :unmount }.not_to raise_error
46
+ expect { resource.action :remount }.not_to raise_error
47
+ expect { resource.action :brooklyn }.to raise_error(ArgumentError)
50
48
  end
51
49
 
52
- it "should allow you to set the device attribute" do
53
- @resource.device "/dev/sdb3"
54
- expect(@resource.device).to eql("/dev/sdb3")
50
+ it "allows you to set the device attribute" do
51
+ resource.device "/dev/sdb3"
52
+ expect(resource.device).to eql("/dev/sdb3")
55
53
  end
56
54
 
57
- it "should set fsck_device to '-' by default" do
58
- expect(@resource.fsck_device).to eql("-")
55
+ it "sets fsck_device to '-' by default" do
56
+ expect(resource.fsck_device).to eql("-")
59
57
  end
60
58
 
61
- it "should allow you to set the fsck_device attribute" do
62
- @resource.fsck_device "/dev/rdsk/sdb3"
63
- expect(@resource.fsck_device).to eql("/dev/rdsk/sdb3")
59
+ it "allows you to set the fsck_device attribute" do
60
+ resource.fsck_device "/dev/rdsk/sdb3"
61
+ expect(resource.fsck_device).to eql("/dev/rdsk/sdb3")
64
62
  end
65
63
 
66
- it "should allow you to set the fstype attribute" do
67
- @resource.fstype "nfs"
68
- expect(@resource.fstype).to eql("nfs")
64
+ it "allows you to set the fstype attribute" do
65
+ resource.fstype "nfs"
66
+ expect(resource.fstype).to eql("nfs")
69
67
  end
70
68
 
71
- it "should allow you to set the dump attribute" do
72
- @resource.dump 1
73
- expect(@resource.dump).to eql(1)
69
+ it "allows you to set the dump attribute" do
70
+ resource.dump 1
71
+ expect(resource.dump).to eql(1)
74
72
  end
75
73
 
76
- it "should allow you to set the pass attribute" do
77
- @resource.pass 1
78
- expect(@resource.pass).to eql(1)
74
+ it "allows you to set the pass attribute" do
75
+ resource.pass 1
76
+ expect(resource.pass).to eql(1)
79
77
  end
80
78
 
81
- it "should set the options attribute to defaults" do
82
- expect(@resource.options).to eql(["defaults"])
79
+ it "sets the options attribute to defaults" do
80
+ expect(resource.options).to eql(["defaults"])
83
81
  end
84
82
 
85
- it "should allow options to be sent as a string, and convert to array" do
86
- @resource.options "rw,noexec"
87
- expect(@resource.options).to be_a_kind_of(Array)
83
+ it "allows options to be sent as a string, and convert to array" do
84
+ resource.options "rw,noexec"
85
+ expect(resource.options).to be_a_kind_of(Array)
88
86
  end
89
87
 
90
- it "should allow options attribute as an array" do
91
- @resource.options %w{ro nosuid}
92
- expect(@resource.options).to be_a_kind_of(Array)
88
+ it "allows options attribute as an array" do
89
+ resource.options %w{ro nosuid}
90
+ expect(resource.options).to be_a_kind_of(Array)
93
91
  end
94
92
 
95
- it "should allow options to be sent as a delayed evaluator" do
96
- @resource.options Chef::DelayedEvaluator.new { %w{rw noexec} }
97
- expect(@resource.options).to eql(%w{rw noexec})
93
+ it "allows options to be sent as a delayed evaluator" do
94
+ resource.options Chef::DelayedEvaluator.new { %w{rw noexec} }
95
+ expect(resource.options).to eql(%w{rw noexec})
98
96
  end
99
97
 
100
- it "should allow options to be sent as a delayed evaluator, and convert to array" do
101
- @resource.options Chef::DelayedEvaluator.new { "rw,noexec" }
102
- expect(@resource.options).to be_a_kind_of(Array)
103
- expect(@resource.options).to eql(%w{rw noexec})
98
+ it "allows options to be sent as a delayed evaluator, and convert to array" do
99
+ resource.options Chef::DelayedEvaluator.new { "rw,noexec" }
100
+ expect(resource.options).to be_a_kind_of(Array)
101
+ expect(resource.options).to eql(%w{rw noexec})
104
102
  end
105
103
 
106
- it "should accept true for mounted" do
107
- @resource.mounted(true)
108
- expect(@resource.mounted).to eql(true)
104
+ it "accepts true for mounted" do
105
+ resource.mounted(true)
106
+ expect(resource.mounted).to eql(true)
109
107
  end
110
108
 
111
- it "should accept false for mounted" do
112
- @resource.mounted(false)
113
- expect(@resource.mounted).to eql(false)
109
+ it "accepts false for mounted" do
110
+ resource.mounted(false)
111
+ expect(resource.mounted).to eql(false)
114
112
  end
115
113
 
116
- it "should set mounted to false by default" do
117
- expect(@resource.mounted).to eql(false)
114
+ it "sets mounted to false by default" do
115
+ expect(resource.mounted).to eql(false)
118
116
  end
119
117
 
120
- it "should not accept a string for mounted" do
121
- expect { @resource.mounted("poop") }.to raise_error(ArgumentError)
118
+ it "does not accept a string for mounted" do
119
+ expect { resource.mounted("poop") }.to raise_error(ArgumentError)
122
120
  end
123
121
 
124
- it "should accept true for enabled" do
125
- @resource.enabled(true)
126
- expect(@resource.enabled).to eql(true)
122
+ it "accepts true for enabled" do
123
+ resource.enabled(true)
124
+ expect(resource.enabled).to eql(true)
127
125
  end
128
126
 
129
- it "should accept false for enabled" do
130
- @resource.enabled(false)
131
- expect(@resource.enabled).to eql(false)
127
+ it "accepts false for enabled" do
128
+ resource.enabled(false)
129
+ expect(resource.enabled).to eql(false)
132
130
  end
133
131
 
134
- it "should set enabled to false by default" do
135
- expect(@resource.enabled).to eql(false)
132
+ it "sets enabled to false by default" do
133
+ expect(resource.enabled).to eql(false)
136
134
  end
137
135
 
138
- it "should not accept a string for enabled" do
139
- expect { @resource.enabled("poop") }.to raise_error(ArgumentError)
136
+ it "does not accept a string for enabled" do
137
+ expect { resource.enabled("poop") }.to raise_error(ArgumentError)
140
138
  end
141
139
 
142
- it "should default all feature support to false" do
140
+ it "defaults all feature support to false" do
143
141
  support_hash = { :remount => false }
144
- expect(@resource.supports).to eq(support_hash)
142
+ expect(resource.supports).to eq(support_hash)
145
143
  end
146
144
 
147
- it "should allow you to set feature support as an array" do
145
+ it "allows you to set feature support as an array" do
148
146
  support_array = [ :remount ]
149
147
  support_hash = { :remount => true }
150
- @resource.supports(support_array)
151
- expect(@resource.supports).to eq(support_hash)
148
+ resource.supports(support_array)
149
+ expect(resource.supports).to eq(support_hash)
152
150
  end
153
151
 
154
- it "should allow you to set feature support as a hash" do
152
+ it "allows you to set feature support as a hash" do
155
153
  support_hash = { :remount => true }
156
- @resource.supports(support_hash)
157
- expect(@resource.supports).to eq(support_hash)
154
+ resource.supports(support_hash)
155
+ expect(resource.supports).to eq(support_hash)
158
156
  end
159
157
 
160
- it "should allow you to set username" do
161
- @resource.username("Administrator")
162
- expect(@resource.username).to eq("Administrator")
158
+ it "allows you to set username" do
159
+ resource.username("Administrator")
160
+ expect(resource.username).to eq("Administrator")
163
161
  end
164
162
 
165
- it "should allow you to set password" do
166
- @resource.password("Jetstream123!")
167
- expect(@resource.password).to eq("Jetstream123!")
163
+ it "allows you to set password" do
164
+ resource.password("Jetstream123!")
165
+ expect(resource.password).to eq("Jetstream123!")
168
166
  end
169
167
 
170
- it "should allow you to set domain" do
171
- @resource.domain("TEST_DOMAIN")
172
- expect(@resource.domain).to eq("TEST_DOMAIN")
168
+ it "allows you to set domain" do
169
+ resource.domain("TEST_DOMAIN")
170
+ expect(resource.domain).to eq("TEST_DOMAIN")
173
171
  end
174
172
 
175
173
  describe "when it has mount point, device type, and fstype" do
176
174
  before do
177
- @resource.device("charmander")
178
- @resource.mount_point("123.456")
179
- @resource.device_type(:device)
180
- @resource.fstype("ranked")
175
+ resource.device("charmander")
176
+ resource.mount_point("123.456")
177
+ resource.device_type(:device)
178
+ resource.fstype("ranked")
181
179
  end
182
180
 
183
181
  it "describes its state" do
184
- state = @resource.state_for_resource_reporter
182
+ state = resource.state_for_resource_reporter
185
183
  expect(state[:mount_point]).to eq("123.456")
186
184
  expect(state[:device_type]).to eql(:device)
187
185
  expect(state[:fstype]).to eq("ranked")
188
186
  end
189
187
 
190
188
  it "returns the device as its identity" do
191
- expect(@resource.identity).to eq("charmander")
189
+ expect(resource.identity).to eq("charmander")
192
190
  end
193
191
  end
194
192
 
195
193
  describe "when it has username, password and domain" do
196
194
  before do
197
- @resource.mount_point("T:")
198
- @resource.device("charmander")
199
- @resource.username("Administrator")
200
- @resource.password("Jetstream123!")
201
- @resource.domain("TEST_DOMAIN")
195
+ resource.mount_point("T:")
196
+ resource.device("charmander")
197
+ resource.username("Administrator")
198
+ resource.password("Jetstream123!")
199
+ resource.domain("TEST_DOMAIN")
202
200
  end
203
201
 
204
202
  it "describes its state" do
205
- state = @resource.state_for_resource_reporter
203
+ state = resource.state_for_resource_reporter
206
204
  expect(state[:mount_point]).to eq("T:")
207
205
  expect(state[:username]).to eq("Administrator")
208
206
  expect(state[:password]).to eq("*sensitive value suppressed*")