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
@@ -19,197 +19,183 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Chef::Resource::RegistryKey, "initialize" do
22
- before(:each) do
23
- @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius')
24
- end
22
+ let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
25
23
 
26
- it "should create a new Chef::Resource::RegistryKey" do
27
- expect(@resource).to be_a_kind_of(Chef::Resource)
28
- expect(@resource).to be_a_kind_of(Chef::Resource::RegistryKey)
24
+ it "creates a new Chef::Resource::RegistryKey" do
25
+ expect(resource).to be_a_kind_of(Chef::Resource)
26
+ expect(resource).to be_a_kind_of(Chef::Resource::RegistryKey)
29
27
  end
30
28
 
31
- it "should set the resource_name to :registry_key" do
32
- expect(@resource.resource_name).to eql(:registry_key)
29
+ it "sets the resource_name to :registry_key" do
30
+ expect(resource.resource_name).to eql(:registry_key)
33
31
  end
34
32
 
35
- it "should set the key equal to the argument to initialize" do
36
- expect(@resource.key).to eql('HKCU\Software\Raxicoricofallapatorius')
33
+ it "sets the key equal to the argument to initialize" do
34
+ expect(resource.key).to eql('HKCU\Software\Raxicoricofallapatorius')
37
35
  end
38
36
 
39
- it "should default recursive to false" do
40
- expect(@resource.recursive).to eql(false)
37
+ it "defaults recursive to false" do
38
+ expect(resource.recursive).to eql(false)
41
39
  end
42
40
 
43
- it "should default architecture to :machine" do
44
- expect(@resource.architecture).to eql(:machine)
41
+ it "defaults architecture to :machine" do
42
+ expect(resource.architecture).to eql(:machine)
45
43
  end
46
44
 
47
- it "should set action to :create" do
48
- expect(@resource.action).to eql([:create])
45
+ it "sets action to :create" do
46
+ expect(resource.action).to eql([:create])
49
47
  end
50
48
 
51
49
  %w{create create_if_missing delete delete_key}.each do |action|
52
- it "should allow action #{action}" do
53
- expect(@resource.allowed_actions.detect { |a| a == action.to_sym }).to eql(action.to_sym)
50
+ it "allows action #{action}" do
51
+ expect(resource.allowed_actions.detect { |a| a == action.to_sym }).to eql(action.to_sym)
54
52
  end
55
53
  end
56
54
  end
57
55
 
58
56
  describe Chef::Resource::RegistryKey, "key" do
59
- before(:each) do
60
- @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius')
61
- end
57
+ let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
62
58
 
63
- it "should allow a string" do
64
- @resource.key 'HKCU\Software\Poosh'
65
- expect(@resource.key).to eql('HKCU\Software\Poosh')
59
+ it "allows a string" do
60
+ resource.key 'HKCU\Software\Poosh'
61
+ expect(resource.key).to eql('HKCU\Software\Poosh')
66
62
  end
67
63
 
68
- it "should not allow an integer" do
69
- expect { @resource.send(:key, 100) }.to raise_error(ArgumentError)
64
+ it "does not allow an integer" do
65
+ expect { resource.send(:key, 100) }.to raise_error(ArgumentError)
70
66
  end
71
67
 
72
- it "should not allow a hash" do
73
- expect { @resource.send(:key, { :sonic => "screwdriver" }) }.to raise_error(ArgumentError)
68
+ it "does not allow a hash" do
69
+ expect { resource.send(:key, { :sonic => "screwdriver" }) }.to raise_error(ArgumentError)
74
70
  end
75
71
  end
76
72
 
77
73
  describe Chef::Resource::RegistryKey, "values" do
78
- before(:each) do
79
- @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius')
80
- end
74
+ let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
81
75
 
82
- it "should allow a single proper hash of registry values" do
83
- @resource.values( { :name => "poosh", :type => :string, :data => "carmen" } )
84
- expect(@resource.values).to eql([ { :name => "poosh", :type => :string, :data => "carmen" } ])
76
+ it "allows a single proper hash of registry values" do
77
+ resource.values( { :name => "poosh", :type => :string, :data => "carmen" } )
78
+ expect(resource.values).to eql([ { :name => "poosh", :type => :string, :data => "carmen" } ])
85
79
  end
86
80
 
87
- it "should allow an array of proper hashes of registry values" do
88
- @resource.values [ { :name => "poosh", :type => :string, :data => "carmen" } ]
89
- expect(@resource.values).to eql([ { :name => "poosh", :type => :string, :data => "carmen" } ])
81
+ it "allows an array of proper hashes of registry values" do
82
+ resource.values [ { :name => "poosh", :type => :string, :data => "carmen" } ]
83
+ expect(resource.values).to eql([ { :name => "poosh", :type => :string, :data => "carmen" } ])
90
84
  end
91
85
 
92
- it "should return checksummed data if the type is unsafe" do
93
- @resource.values( { :name => "poosh", :type => :binary, :data => 255.chr * 1 })
94
- expect(@resource.values).to eql([ { :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" } ])
86
+ it "returns checksummed data if the type is unsafe" do
87
+ resource.values( { :name => "poosh", :type => :binary, :data => 255.chr * 1 })
88
+ expect(resource.values).to eql([ { :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" } ])
95
89
  end
96
90
 
97
- it "should raise an exception if the name field is missing" do
98
- expect { @resource.values [ { :type => :string, :data => "carmen" } ] }.to raise_error(ArgumentError)
91
+ it "raises an exception if the name field is missing" do
92
+ expect { resource.values [ { :type => :string, :data => "carmen" } ] }.to raise_error(ArgumentError)
99
93
  end
100
94
 
101
- it "should raise an exception if extra fields are present" do
102
- expect { @resource.values [ { :name => "poosh", :type => :string, :data => "carmen", :screwdriver => "sonic" } ] }.to raise_error(ArgumentError)
95
+ it "raises an exception if extra fields are present" do
96
+ expect { resource.values [ { :name => "poosh", :type => :string, :data => "carmen", :screwdriver => "sonic" } ] }.to raise_error(ArgumentError)
103
97
  end
104
98
 
105
- it "should not allow a string" do
106
- expect { @resource.send(:values, "souffle") }.to raise_error(ArgumentError)
99
+ it "does not allow a string" do
100
+ expect { resource.send(:values, "souffle") }.to raise_error(ArgumentError)
107
101
  end
108
102
 
109
- it "should not allow an integer" do
110
- expect { @resource.send(:values, 100) }.to raise_error(ArgumentError)
103
+ it "does not allow an integer" do
104
+ expect { resource.send(:values, 100) }.to raise_error(ArgumentError)
111
105
  end
112
106
 
113
- it "should raise an exception if type of name is not string" do
114
- expect { @resource.values([ { :name => 123, :type => :string, :data => "carmen" } ]) }.to raise_error(ArgumentError)
107
+ it "raises an exception if type of name is not string" do
108
+ expect { resource.values([ { :name => 123, :type => :string, :data => "carmen" } ]) }.to raise_error(ArgumentError)
115
109
  end
116
110
 
117
- it "should not raise an exception if type of name is string" do
118
- expect { @resource.values([ { :name => "123", :type => :string, :data => "carmen" } ]) }.to_not raise_error
111
+ it "does not raise an exception if type of name is string" do
112
+ expect { resource.values([ { :name => "123", :type => :string, :data => "carmen" } ]) }.to_not raise_error
119
113
  end
120
114
 
121
115
  context "type key not given" do
122
- it "should not raise an exception" do
123
- expect { @resource.values([ { :name => "123", :data => "carmen" } ]) }.to_not raise_error
116
+ it "does not raise an exception" do
117
+ expect { resource.values([ { :name => "123", :data => "carmen" } ]) }.to_not raise_error
124
118
  end
125
119
  end
126
120
 
127
121
  context "type key given" do
128
- it "should raise an exception if type of type is not symbol" do
129
- expect { @resource.values([ { :name => "123", :type => "string", :data => "carmen" } ]) }.to raise_error(ArgumentError)
122
+ it "raises an exception if type of type is not symbol" do
123
+ expect { resource.values([ { :name => "123", :type => "string", :data => "carmen" } ]) }.to raise_error(ArgumentError)
130
124
  end
131
125
 
132
- it "should not raise an exception if type of type is symbol" do
133
- expect { @resource.values([ { :name => "123", :type => :string, :data => "carmen" } ]) }.to_not raise_error
126
+ it "does not raise an exception if type of type is symbol" do
127
+ expect { resource.values([ { :name => "123", :type => :string, :data => "carmen" } ]) }.to_not raise_error
134
128
  end
135
129
  end
136
130
  end
137
131
 
138
132
  describe Chef::Resource::RegistryKey, "recursive" do
139
- before(:each) do
140
- @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius')
141
- end
133
+ let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
142
134
 
143
- it "should allow a boolean" do
144
- @resource.recursive(true)
145
- expect(@resource.recursive).to eql(true)
135
+ it "allows a boolean" do
136
+ resource.recursive(true)
137
+ expect(resource.recursive).to eql(true)
146
138
  end
147
139
 
148
- it "should not allow a hash" do
149
- expect { @resource.recursive({ :sonic => :screwdriver }) }.to raise_error(ArgumentError)
140
+ it "does not allow a hash" do
141
+ expect { resource.recursive({ :sonic => :screwdriver }) }.to raise_error(ArgumentError)
150
142
  end
151
143
 
152
- it "should not allow an array" do
153
- expect { @resource.recursive([:nose, :chin]) }.to raise_error(ArgumentError)
144
+ it "does not allow an array" do
145
+ expect { resource.recursive([:nose, :chin]) }.to raise_error(ArgumentError)
154
146
  end
155
147
 
156
- it "should not allow a string" do
157
- expect { @resource.recursive("souffle") }.to raise_error(ArgumentError)
148
+ it "does not allow a string" do
149
+ expect { resource.recursive("souffle") }.to raise_error(ArgumentError)
158
150
  end
159
151
 
160
- it "should not allow an integer" do
161
- expect { @resource.recursive(100) }.to raise_error(ArgumentError)
152
+ it "does not allow an integer" do
153
+ expect { resource.recursive(100) }.to raise_error(ArgumentError)
162
154
  end
163
155
  end
164
156
 
165
157
  describe Chef::Resource::RegistryKey, "architecture" do
166
- before(:each) do
167
- @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius')
168
- end
158
+ let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
169
159
 
170
160
  [ :i386, :x86_64, :machine ].each do |arch|
171
- it "should allow #{arch} as a symbol" do
172
- @resource.architecture(arch)
173
- expect(@resource.architecture).to eql(arch)
161
+ it "allows #{arch} as a symbol" do
162
+ resource.architecture(arch)
163
+ expect(resource.architecture).to eql(arch)
174
164
  end
175
165
  end
176
166
 
177
- it "should not allow a hash" do
178
- expect { @resource.architecture({ :sonic => :screwdriver }) }.to raise_error(ArgumentError)
167
+ it "does not allow a hash" do
168
+ expect { resource.architecture({ :sonic => :screwdriver }) }.to raise_error(ArgumentError)
179
169
  end
180
170
 
181
- it "should not allow an array" do
182
- expect { @resource.architecture([:nose, :chin]) }.to raise_error(ArgumentError)
171
+ it "does not allow an array" do
172
+ expect { resource.architecture([:nose, :chin]) }.to raise_error(ArgumentError)
183
173
  end
184
174
 
185
- it "should not allow a string" do
186
- expect { @resource.architecture("souffle") }.to raise_error(ArgumentError)
175
+ it "does not allow a string" do
176
+ expect { resource.architecture("souffle") }.to raise_error(ArgumentError)
187
177
  end
188
178
 
189
- it "should not allow an integer" do
190
- expect { @resource.architecture(100) }.to raise_error(ArgumentError)
179
+ it "does not allow an integer" do
180
+ expect { resource.architecture(100) }.to raise_error(ArgumentError)
191
181
  end
192
182
  end
193
183
 
194
184
  describe Chef::Resource::RegistryKey, ":unscrubbed_values" do
195
- before(:each) do
196
- @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius')
197
- end
185
+ let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
198
186
 
199
- it "should return unsafe data as-is" do
187
+ it "returns unsafe data as-is" do
200
188
  key_values = [ { :name => "poosh", :type => :binary, :data => 255.chr * 1 } ]
201
- @resource.values(key_values)
202
- expect(@resource.unscrubbed_values).to eql(key_values)
189
+ resource.values(key_values)
190
+ expect(resource.unscrubbed_values).to eql(key_values)
203
191
  end
204
192
  end
205
193
 
206
194
  describe Chef::Resource::RegistryKey, "state" do
207
- before(:each) do
208
- @resource = Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius')
209
- end
195
+ let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
210
196
 
211
- it "should return scrubbed values" do
212
- @resource.values([ { :name => "poosh", :type => :binary, :data => 255.chr * 1 } ])
213
- expect(@resource.state_for_resource_reporter).to eql( { :values => [{ :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" }] } )
197
+ it "returns scrubbed values" do
198
+ resource.values([ { :name => "poosh", :type => :binary, :data => 255.chr * 1 } ])
199
+ expect(resource.state_for_resource_reporter).to eql( { :values => [{ :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" }] } )
214
200
  end
215
201
  end
@@ -20,78 +20,76 @@ require "spec_helper"
20
20
 
21
21
  describe Chef::Resource::RemoteDirectory do
22
22
 
23
- before(:each) do
24
- @resource = Chef::Resource::RemoteDirectory.new("/etc/dunk")
25
- end
23
+ let(:resource) { Chef::Resource::RemoteDirectory.new("/etc/dunk") }
26
24
 
27
- it "should create a new Chef::Resource::RemoteDirectory" do
28
- expect(@resource).to be_a_kind_of(Chef::Resource)
29
- expect(@resource).to be_a_kind_of(Chef::Resource::RemoteDirectory)
25
+ it "creates a new Chef::Resource::RemoteDirectory" do
26
+ expect(resource).to be_a_kind_of(Chef::Resource)
27
+ expect(resource).to be_a_kind_of(Chef::Resource::RemoteDirectory)
30
28
  end
31
29
 
32
- it "should set the path to the first argument to new" do
33
- expect(@resource.path).to eql("/etc/dunk")
30
+ it "sets the path to the first argument to new" do
31
+ expect(resource.path).to eql("/etc/dunk")
34
32
  end
35
33
 
36
- it "should accept a string for the remote directory source" do
37
- @resource.source "foo"
38
- expect(@resource.source).to eql("foo")
34
+ it "accepts a string for the remote directory source" do
35
+ resource.source "foo"
36
+ expect(resource.source).to eql("foo")
39
37
  end
40
38
 
41
- it "should have the basename of the remote directory resource as the default source" do
42
- expect(@resource.source).to eql("dunk")
39
+ it "has the basename of the remote directory resource as the default source" do
40
+ expect(resource.source).to eql("dunk")
43
41
  end
44
42
 
45
- it "should accept a number for the remote files backup" do
46
- @resource.files_backup 1
47
- expect(@resource.files_backup).to eql(1)
43
+ it "accepts a number for the remote files backup" do
44
+ resource.files_backup 1
45
+ expect(resource.files_backup).to eql(1)
48
46
  end
49
47
 
50
- it "should accept false for the remote files backup" do
51
- @resource.files_backup false
52
- expect(@resource.files_backup).to eql(false)
48
+ it "accepts false for the remote files backup" do
49
+ resource.files_backup false
50
+ expect(resource.files_backup).to eql(false)
53
51
  end
54
52
 
55
- it "should accept 3 or 4 digets for the files_mode" do
56
- @resource.files_mode 100
57
- expect(@resource.files_mode).to eql(100)
58
- @resource.files_mode 1000
59
- expect(@resource.files_mode).to eql(1000)
53
+ it "accepts 3 or 4 digets for the files_mode" do
54
+ resource.files_mode 100
55
+ expect(resource.files_mode).to eql(100)
56
+ resource.files_mode 1000
57
+ expect(resource.files_mode).to eql(1000)
60
58
  end
61
59
 
62
- it "should accept a string or number for the files group" do
63
- @resource.files_group "heart"
64
- expect(@resource.files_group).to eql("heart")
65
- @resource.files_group 1000
66
- expect(@resource.files_group).to eql(1000)
60
+ it "accepts a string or number for the files group" do
61
+ resource.files_group "heart"
62
+ expect(resource.files_group).to eql("heart")
63
+ resource.files_group 1000
64
+ expect(resource.files_group).to eql(1000)
67
65
  end
68
66
 
69
- it "should accept a string or number for the files owner" do
70
- @resource.files_owner "heart"
71
- expect(@resource.files_owner).to eql("heart")
72
- @resource.files_owner 1000
73
- expect(@resource.files_owner).to eql(1000)
67
+ it "accepts a string or number for the files owner" do
68
+ resource.files_owner "heart"
69
+ expect(resource.files_owner).to eql("heart")
70
+ resource.files_owner 1000
71
+ expect(resource.files_owner).to eql(1000)
74
72
  end
75
73
 
76
74
  describe "when it has cookbook, files owner, files mode, and source" do
77
75
  before do
78
- @resource.path("/var/path/")
79
- @resource.cookbook("pokemon.rb")
80
- @resource.files_owner("root")
81
- @resource.files_group("supergroup")
82
- @resource.files_mode("0664")
83
- @resource.source("/var/source/")
76
+ resource.path("/var/path/")
77
+ resource.cookbook("pokemon.rb")
78
+ resource.files_owner("root")
79
+ resource.files_group("supergroup")
80
+ resource.files_mode("0664")
81
+ resource.source("/var/source/")
84
82
  end
85
83
 
86
84
  it "describes its state" do
87
- state = @resource.state_for_resource_reporter
85
+ state = resource.state_for_resource_reporter
88
86
  expect(state[:files_owner]).to eq("root")
89
87
  expect(state[:files_group]).to eq("supergroup")
90
88
  expect(state[:files_mode]).to eq("0664")
91
89
  end
92
90
 
93
91
  it "returns the path as its identity" do
94
- expect(@resource.identity).to eq("/var/path/")
92
+ expect(resource.identity).to eq("/var/path/")
95
93
  end
96
94
  end
97
95
  end
@@ -21,147 +21,145 @@ require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::RemoteFile do
23
23
 
24
- before(:each) do
25
- @resource = Chef::Resource::RemoteFile.new("fakey_fakerton")
26
- end
24
+ let(:resource) { Chef::Resource::RemoteFile.new("fakey_fakerton") }
27
25
 
28
26
  describe "initialize" do
29
- it "should create a new Chef::Resource::RemoteFile" do
30
- expect(@resource).to be_a_kind_of(Chef::Resource)
31
- expect(@resource).to be_a_kind_of(Chef::Resource::File)
32
- expect(@resource).to be_a_kind_of(Chef::Resource::RemoteFile)
27
+ it "creates a new Chef::Resource::RemoteFile" do
28
+ expect(resource).to be_a_kind_of(Chef::Resource)
29
+ expect(resource).to be_a_kind_of(Chef::Resource::File)
30
+ expect(resource).to be_a_kind_of(Chef::Resource::RemoteFile)
33
31
  end
34
32
  end
35
33
 
36
34
  it "says its provider is RemoteFile when the source is an absolute URI" do
37
- @resource.source("http://www.google.com/robots.txt")
38
- expect(@resource.provider).to eq(Chef::Provider::RemoteFile)
39
- expect(@resource.provider_for_action(:create)).to be_kind_of(Chef::Provider::RemoteFile)
35
+ resource.source("http://www.google.com/robots.txt")
36
+ expect(resource.provider).to eq(Chef::Provider::RemoteFile)
37
+ expect(resource.provider_for_action(:create)).to be_kind_of(Chef::Provider::RemoteFile)
40
38
  end
41
39
 
42
40
  it "says its provider is RemoteFile when the source is a network share" do
43
- @resource.source("\\\\fakey\\fakerton\\fake.txt")
44
- expect(@resource.provider).to eq(Chef::Provider::RemoteFile)
45
- expect(@resource.provider_for_action(:create)).to be_kind_of(Chef::Provider::RemoteFile)
41
+ resource.source("\\\\fakey\\fakerton\\fake.txt")
42
+ expect(resource.provider).to eq(Chef::Provider::RemoteFile)
43
+ expect(resource.provider_for_action(:create)).to be_kind_of(Chef::Provider::RemoteFile)
46
44
  end
47
45
 
48
46
  describe "source" do
49
47
  it "does not have a default value for 'source'" do
50
- expect(@resource.source).to eql([])
48
+ expect(resource.source).to eql([])
51
49
  end
52
50
 
53
- it "should accept a URI for the remote file source" do
54
- @resource.source "http://opscode.com/"
55
- expect(@resource.source).to eql([ "http://opscode.com/" ])
51
+ it "accepts a URI for the remote file source" do
52
+ resource.source "http://opscode.com/"
53
+ expect(resource.source).to eql([ "http://opscode.com/" ])
56
54
  end
57
55
 
58
- it "should accept a windows network share source" do
59
- @resource.source "\\\\fakey\\fakerton\\fake.txt"
60
- expect(@resource.source).to eql([ "\\\\fakey\\fakerton\\fake.txt" ])
56
+ it "accepts a windows network share source" do
57
+ resource.source "\\\\fakey\\fakerton\\fake.txt"
58
+ expect(resource.source).to eql([ "\\\\fakey\\fakerton\\fake.txt" ])
61
59
  end
62
60
 
63
- it "should accept file URIs with spaces" do
64
- @resource.source("file:///C:/foo bar")
65
- expect(@resource.source).to eql(["file:///C:/foo bar"])
61
+ it "accepts file URIs with spaces" do
62
+ resource.source("file:///C:/foo bar")
63
+ expect(resource.source).to eql(["file:///C:/foo bar"])
66
64
  end
67
65
 
68
- it "should accept a delayed evalutator (string) for the remote file source" do
69
- @resource.source Chef::DelayedEvaluator.new { "http://opscode.com/" }
70
- expect(@resource.source).to eql([ "http://opscode.com/" ])
66
+ it "accepts a delayed evalutator (string) for the remote file source" do
67
+ resource.source Chef::DelayedEvaluator.new { "http://opscode.com/" }
68
+ expect(resource.source).to eql([ "http://opscode.com/" ])
71
69
  end
72
70
 
73
- it "should accept an array of URIs for the remote file source" do
74
- @resource.source([ "http://opscode.com/", "http://puppetlabs.com/" ])
75
- expect(@resource.source).to eql([ "http://opscode.com/", "http://puppetlabs.com/" ])
71
+ it "accepts an array of URIs for the remote file source" do
72
+ resource.source([ "http://opscode.com/", "http://puppetlabs.com/" ])
73
+ expect(resource.source).to eql([ "http://opscode.com/", "http://puppetlabs.com/" ])
76
74
  end
77
75
 
78
- it "should accept a delated evaluator (array) for the remote file source" do
79
- @resource.source Chef::DelayedEvaluator.new { [ "http://opscode.com/", "http://puppetlabs.com/" ] }
80
- expect(@resource.source).to eql([ "http://opscode.com/", "http://puppetlabs.com/" ])
76
+ it "accepts a delated evaluator (array) for the remote file source" do
77
+ resource.source Chef::DelayedEvaluator.new { [ "http://opscode.com/", "http://puppetlabs.com/" ] }
78
+ expect(resource.source).to eql([ "http://opscode.com/", "http://puppetlabs.com/" ])
81
79
  end
82
80
 
83
- it "should accept an multiple URIs as arguments for the remote file source" do
84
- @resource.source("http://opscode.com/", "http://puppetlabs.com/")
85
- expect(@resource.source).to eql([ "http://opscode.com/", "http://puppetlabs.com/" ])
81
+ it "accepts an multiple URIs as arguments for the remote file source" do
82
+ resource.source("http://opscode.com/", "http://puppetlabs.com/")
83
+ expect(resource.source).to eql([ "http://opscode.com/", "http://puppetlabs.com/" ])
86
84
  end
87
85
 
88
- it "should only accept a single argument if a delayed evalutor is used" do
86
+ it "only accept a single argument if a delayed evalutor is used" do
89
87
  expect do
90
- @resource.source("http://opscode.com/", Chef::DelayedEvaluator.new { "http://opscode.com/" })
88
+ resource.source("http://opscode.com/", Chef::DelayedEvaluator.new { "http://opscode.com/" })
91
89
  end.to raise_error(Chef::Exceptions::InvalidRemoteFileURI)
92
90
  end
93
91
 
94
- it "should only accept a single array item if a delayed evalutor is used" do
92
+ it "only accept a single array item if a delayed evalutor is used" do
95
93
  expect do
96
- @resource.source(["http://opscode.com/", Chef::DelayedEvaluator.new { "http://opscode.com/" }])
94
+ resource.source(["http://opscode.com/", Chef::DelayedEvaluator.new { "http://opscode.com/" }])
97
95
  end.to raise_error(Chef::Exceptions::InvalidRemoteFileURI)
98
96
  end
99
97
 
100
98
  it "does not accept a non-URI as the source" do
101
- expect { @resource.source("not-a-uri") }.to raise_error(Chef::Exceptions::InvalidRemoteFileURI)
99
+ expect { resource.source("not-a-uri") }.to raise_error(Chef::Exceptions::InvalidRemoteFileURI)
102
100
  end
103
101
 
104
102
  it "does not accept a non-URI as the source when read from a delayed evaluator" do
105
103
  expect do
106
- @resource.source(Chef::DelayedEvaluator.new { "not-a-uri" })
107
- @resource.source
104
+ resource.source(Chef::DelayedEvaluator.new { "not-a-uri" })
105
+ resource.source
108
106
  end.to raise_error(Chef::Exceptions::InvalidRemoteFileURI)
109
107
  end
110
108
 
111
- it "should raise an exception when source is an empty array" do
112
- expect { @resource.source([]) }.to raise_error(ArgumentError)
109
+ it "raises an exception when source is an empty array" do
110
+ expect { resource.source([]) }.to raise_error(ArgumentError)
113
111
  end
114
112
 
115
113
  end
116
114
 
117
115
  describe "checksum" do
118
- it "should accept a string for the checksum object" do
119
- @resource.checksum "asdf"
120
- expect(@resource.checksum).to eql("asdf")
116
+ it "accepts a string for the checksum object" do
117
+ resource.checksum "asdf"
118
+ expect(resource.checksum).to eql("asdf")
121
119
  end
122
120
 
123
- it "should default to nil" do
124
- expect(@resource.checksum).to eq(nil)
121
+ it "defaults to nil" do
122
+ expect(resource.checksum).to eq(nil)
125
123
  end
126
124
  end
127
125
 
128
126
  describe "ftp_active_mode" do
129
- it "should accept a boolean for the ftp_active_mode object" do
130
- @resource.ftp_active_mode true
131
- expect(@resource.ftp_active_mode).to be_truthy
127
+ it "accepts a boolean for the ftp_active_mode object" do
128
+ resource.ftp_active_mode true
129
+ expect(resource.ftp_active_mode).to be_truthy
132
130
  end
133
131
 
134
- it "should default to false" do
135
- expect(@resource.ftp_active_mode).to be_falsey
132
+ it "defaults to false" do
133
+ expect(resource.ftp_active_mode).to be_falsey
136
134
  end
137
135
  end
138
136
 
139
137
  describe "conditional get options" do
140
138
  it "defaults to using etags and last modified" do
141
- expect(@resource.use_etags).to be_truthy
142
- expect(@resource.use_last_modified).to be_truthy
139
+ expect(resource.use_etags).to be_truthy
140
+ expect(resource.use_last_modified).to be_truthy
143
141
  end
144
142
 
145
143
  it "enable or disables etag and last modified options as a group" do
146
- @resource.use_conditional_get(false)
147
- expect(@resource.use_etags).to be_falsey
148
- expect(@resource.use_last_modified).to be_falsey
144
+ resource.use_conditional_get(false)
145
+ expect(resource.use_etags).to be_falsey
146
+ expect(resource.use_last_modified).to be_falsey
149
147
 
150
- @resource.use_conditional_get(true)
151
- expect(@resource.use_etags).to be_truthy
152
- expect(@resource.use_last_modified).to be_truthy
148
+ resource.use_conditional_get(true)
149
+ expect(resource.use_etags).to be_truthy
150
+ expect(resource.use_last_modified).to be_truthy
153
151
  end
154
152
 
155
153
  it "disables etags indivdually" do
156
- @resource.use_etags(false)
157
- expect(@resource.use_etags).to be_falsey
158
- expect(@resource.use_last_modified).to be_truthy
154
+ resource.use_etags(false)
155
+ expect(resource.use_etags).to be_falsey
156
+ expect(resource.use_last_modified).to be_truthy
159
157
  end
160
158
 
161
159
  it "disables last modified individually" do
162
- @resource.use_last_modified(false)
163
- expect(@resource.use_last_modified).to be_falsey
164
- expect(@resource.use_etags).to be_truthy
160
+ resource.use_last_modified(false)
161
+ expect(resource.use_last_modified).to be_falsey
162
+ expect(resource.use_etags).to be_truthy
165
163
  end
166
164
 
167
165
  end
@@ -169,21 +167,21 @@ describe Chef::Resource::RemoteFile do
169
167
  describe "when it has group, mode, owner, source, and checksum" do
170
168
  before do
171
169
  if Chef::Platform.windows?
172
- @resource.path("C:/temp/origin/file.txt")
173
- @resource.rights(:read, "Everyone")
174
- @resource.deny_rights(:full_control, "Clumsy_Sam")
170
+ resource.path("C:/temp/origin/file.txt")
171
+ resource.rights(:read, "Everyone")
172
+ resource.deny_rights(:full_control, "Clumsy_Sam")
175
173
  else
176
- @resource.path("/this/path/")
177
- @resource.group("pokemon")
178
- @resource.mode("0664")
179
- @resource.owner("root")
174
+ resource.path("/this/path/")
175
+ resource.group("pokemon")
176
+ resource.mode("0664")
177
+ resource.owner("root")
180
178
  end
181
- @resource.source("https://www.google.com/images/srpr/logo3w.png")
182
- @resource.checksum("1" * 26)
179
+ resource.source("https://www.google.com/images/srpr/logo3w.png")
180
+ resource.checksum("1" * 26)
183
181
  end
184
182
 
185
183
  it "describes its state" do
186
- state = @resource.state_for_resource_reporter
184
+ state = resource.state_for_resource_reporter
187
185
  if Chef::Platform.windows?
188
186
  puts state
189
187
  expect(state[:rights]).to eq([{ :permissions => :read, :principals => "Everyone" }])
@@ -198,9 +196,9 @@ describe Chef::Resource::RemoteFile do
198
196
 
199
197
  it "returns the path as its identity" do
200
198
  if Chef::Platform.windows?
201
- expect(@resource.identity).to eq("C:/temp/origin/file.txt")
199
+ expect(resource.identity).to eq("C:/temp/origin/file.txt")
202
200
  else
203
- expect(@resource.identity).to eq("/this/path/")
201
+ expect(resource.identity).to eq("/this/path/")
204
202
  end
205
203
  end
206
204
  end