chefspec 5.1.0 → 5.2.0

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 (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/examples/attributes/spec/default_spec.rb +1 -1
  4. data/examples/cached/spec/default_spec.rb +1 -1
  5. data/examples/chef_gem/spec/install_spec.rb +1 -1
  6. data/examples/chef_gem/spec/purge_spec.rb +1 -1
  7. data/examples/chef_gem/spec/reconfig_spec.rb +1 -1
  8. data/examples/chef_gem/spec/remove_spec.rb +1 -1
  9. data/examples/chef_gem/spec/upgrade_spec.rb +1 -1
  10. data/examples/compile_time/spec/default_spec.rb +1 -1
  11. data/examples/cookbook_file/spec/create_if_missing_spec.rb +1 -1
  12. data/examples/cookbook_file/spec/create_spec.rb +1 -1
  13. data/examples/cookbook_file/spec/delete_spec.rb +1 -1
  14. data/examples/cookbook_file/spec/touch_spec.rb +1 -1
  15. data/examples/cron/spec/create_spec.rb +1 -1
  16. data/examples/cron/spec/delete_spec.rb +1 -1
  17. data/examples/custom_matcher/spec/install_spec.rb +1 -1
  18. data/examples/custom_matcher/spec/remove_spec.rb +1 -1
  19. data/examples/deploy/spec/deploy_spec.rb +1 -1
  20. data/examples/deploy/spec/force_deploy_spec.rb +1 -1
  21. data/examples/deploy/spec/rollback_spec.rb +1 -1
  22. data/examples/directory/spec/create_spec.rb +1 -1
  23. data/examples/directory/spec/delete_spec.rb +1 -1
  24. data/examples/do_nothing/spec/default_spec.rb +1 -1
  25. data/examples/easy_install_package/spec/install_spec.rb +1 -1
  26. data/examples/easy_install_package/spec/purge_spec.rb +1 -1
  27. data/examples/easy_install_package/spec/remove_spec.rb +1 -1
  28. data/examples/easy_install_package/spec/upgrade_spec.rb +1 -1
  29. data/examples/erl_call/spec/run_spec.rb +1 -1
  30. data/examples/execute/spec/run_spec.rb +1 -1
  31. data/examples/expect_exception/spec/compile_error_spec.rb +1 -1
  32. data/examples/expect_exception/spec/converge_error_spec.rb +1 -1
  33. data/examples/expect_exception/spec/no_error_spec.rb +1 -1
  34. data/examples/file/spec/create_if_missing_spec.rb +1 -1
  35. data/examples/file/spec/create_spec.rb +1 -1
  36. data/examples/file/spec/delete_spec.rb +1 -1
  37. data/examples/file/spec/touch_spec.rb +1 -1
  38. data/examples/gem_package/spec/install_spec.rb +1 -1
  39. data/examples/gem_package/spec/purge_spec.rb +1 -1
  40. data/examples/gem_package/spec/reconfig_spec.rb +1 -1
  41. data/examples/gem_package/spec/remove_spec.rb +1 -1
  42. data/examples/gem_package/spec/upgrade_spec.rb +1 -1
  43. data/examples/git/spec/checkout_spec.rb +1 -1
  44. data/examples/git/spec/export_spec.rb +1 -1
  45. data/examples/git/spec/sync_spec.rb +1 -1
  46. data/examples/group/spec/create_spec.rb +1 -1
  47. data/examples/group/spec/manage_spec.rb +1 -1
  48. data/examples/group/spec/modify_spec.rb +1 -1
  49. data/examples/group/spec/remove_spec.rb +1 -1
  50. data/examples/guards/spec/default_spec.rb +1 -1
  51. data/examples/heavy_provider_light_resource/spec/provider_service_spec.rb +1 -1
  52. data/examples/http_request/spec/delete_spec.rb +1 -1
  53. data/examples/http_request/spec/get_spec.rb +1 -1
  54. data/examples/http_request/spec/head_spec.rb +1 -1
  55. data/examples/http_request/spec/options_spec.rb +1 -1
  56. data/examples/http_request/spec/post_spec.rb +1 -1
  57. data/examples/http_request/spec/put_spec.rb +1 -1
  58. data/examples/ifconfig/spec/add_spec.rb +1 -1
  59. data/examples/ifconfig/spec/delete_spec.rb +1 -1
  60. data/examples/ifconfig/spec/disable_spec.rb +1 -1
  61. data/examples/ifconfig/spec/enable_spec.rb +1 -1
  62. data/examples/include_recipe/spec/default_spec.rb +1 -1
  63. data/examples/link/spec/create_spec.rb +1 -1
  64. data/examples/link/spec/delete_spec.rb +1 -1
  65. data/examples/link/spec/link_to_spec.rb +1 -1
  66. data/examples/log/spec/write_spec.rb +1 -1
  67. data/examples/macports_package/spec/install_spec.rb +1 -1
  68. data/examples/macports_package/spec/purge_spec.rb +1 -1
  69. data/examples/macports_package/spec/remove_spec.rb +1 -1
  70. data/examples/macports_package/spec/upgrade_spec.rb +1 -1
  71. data/examples/mdadm/spec/assemble_spec.rb +1 -1
  72. data/examples/mdadm/spec/create_spec.rb +1 -1
  73. data/examples/mdadm/spec/stop_spec.rb +1 -1
  74. data/examples/mount/spec/disable_spec.rb +1 -1
  75. data/examples/mount/spec/enable_spec.rb +1 -1
  76. data/examples/mount/spec/mount_spec.rb +1 -1
  77. data/examples/mount/spec/remount_spec.rb +1 -1
  78. data/examples/mount/spec/umount_spec.rb +1 -1
  79. data/examples/multiple_actions/spec/default_spec.rb +1 -1
  80. data/examples/multiple_actions/spec/sequential_spec.rb +2 -2
  81. data/examples/multiple_run_action/spec/default_spec.rb +1 -1
  82. data/examples/notifications/spec/before_spec.rb +1 -1
  83. data/examples/notifications/spec/chained_spec.rb +1 -1
  84. data/examples/notifications/spec/default_spec.rb +1 -1
  85. data/examples/notifications/spec/delayed_spec.rb +1 -1
  86. data/examples/notifications/spec/immediately_spec.rb +1 -1
  87. data/examples/ohai/spec/reload_spec.rb +1 -1
  88. data/examples/package/spec/install_spec.rb +1 -1
  89. data/examples/package/spec/purge_spec.rb +1 -1
  90. data/examples/package/spec/reconfig_spec.rb +1 -1
  91. data/examples/package/spec/remove_spec.rb +1 -1
  92. data/examples/package/spec/upgrade_spec.rb +1 -1
  93. data/examples/reboot/spec/cancel_spec.rb +1 -1
  94. data/examples/reboot/spec/now_spec.rb +1 -1
  95. data/examples/reboot/spec/request_spec.rb +1 -1
  96. data/examples/remote_directory/spec/create_if_missing_spec.rb +1 -1
  97. data/examples/remote_directory/spec/create_spec.rb +1 -1
  98. data/examples/remote_directory/spec/delete_spec.rb +1 -1
  99. data/examples/remote_file/spec/create_if_missing_spec.rb +1 -1
  100. data/examples/remote_file/spec/create_spec.rb +1 -1
  101. data/examples/remote_file/spec/delete_spec.rb +1 -1
  102. data/examples/remote_file/spec/touch_spec.rb +1 -1
  103. data/examples/render_file/spec/default_spec.rb +1 -1
  104. data/examples/render_file/spec/template_helpers_spec.rb +1 -1
  105. data/examples/route/spec/add_spec.rb +1 -1
  106. data/examples/route/spec/delete_spec.rb +1 -1
  107. data/examples/ruby_block/spec/run_spec.rb +1 -1
  108. data/examples/script/spec/run_bash_spec.rb +1 -1
  109. data/examples/script/spec/run_csh_spec.rb +1 -1
  110. data/examples/script/spec/run_perl_spec.rb +1 -1
  111. data/examples/script/spec/run_python_spec.rb +1 -1
  112. data/examples/script/spec/run_ruby_spec.rb +1 -1
  113. data/examples/script/spec/run_script_spec.rb +1 -1
  114. data/examples/server/spec/client_spec.rb +1 -1
  115. data/examples/server/spec/data_bag_spec.rb +1 -1
  116. data/examples/server/spec/environment_spec.rb +1 -1
  117. data/examples/server/spec/node_spec.rb +4 -4
  118. data/examples/server/spec/render_with_cached_spec.rb +1 -1
  119. data/examples/server/spec/role_spec.rb +1 -1
  120. data/examples/server/spec/search_spec.rb +2 -2
  121. data/examples/service/spec/disable_spec.rb +1 -1
  122. data/examples/service/spec/enable_spec.rb +1 -1
  123. data/examples/service/spec/reload_spec.rb +1 -1
  124. data/examples/service/spec/restart_spec.rb +1 -1
  125. data/examples/service/spec/start_spec.rb +1 -1
  126. data/examples/service/spec/stop_spec.rb +1 -1
  127. data/examples/state_attrs/spec/default_spec.rb +1 -1
  128. data/examples/step_into/spec/default_spec.rb +1 -1
  129. data/examples/stub_command/spec/default_spec.rb +1 -1
  130. data/examples/subscribes/spec/before_spec.rb +1 -1
  131. data/examples/subscribes/spec/chained_spec.rb +1 -1
  132. data/examples/subscribes/spec/default_spec.rb +1 -1
  133. data/examples/subscribes/spec/delayed_spec.rb +1 -1
  134. data/examples/subscribes/spec/immediately_spec.rb +1 -1
  135. data/examples/subversion/spec/checkout_spec.rb +1 -1
  136. data/examples/subversion/spec/export_spec.rb +1 -1
  137. data/examples/subversion/spec/force_export_spec.rb +1 -1
  138. data/examples/subversion/spec/sync_spec.rb +1 -1
  139. data/examples/template/spec/create_if_missing_spec.rb +1 -1
  140. data/examples/template/spec/create_spec.rb +1 -1
  141. data/examples/template/spec/delete_spec.rb +1 -1
  142. data/examples/template/spec/touch_spec.rb +1 -1
  143. data/examples/use_inline_resources/spec/default_spec.rb +1 -1
  144. data/examples/user/spec/create_spec.rb +2 -2
  145. data/examples/user/spec/lock_spec.rb +2 -2
  146. data/examples/user/spec/manage_spec.rb +2 -2
  147. data/examples/user/spec/modify_spec.rb +2 -2
  148. data/examples/user/spec/remove_spec.rb +2 -2
  149. data/examples/user/spec/unlock_spec.rb +2 -2
  150. data/examples/yum_repository/recipes/add.rb +8 -0
  151. data/examples/yum_repository/recipes/delete.rb +3 -0
  152. data/examples/yum_repository/recipes/makecache.rb +3 -0
  153. data/examples/yum_repository/recipes/remove.rb +4 -0
  154. data/examples/yum_repository/spec/add_spec.rb +12 -0
  155. data/examples/yum_repository/spec/create_spec.rb +1 -1
  156. data/examples/yum_repository/spec/delete_spec.rb +12 -0
  157. data/examples/yum_repository/spec/{make_cache_spec.rb → makecache_spec.rb} +2 -2
  158. data/examples/yum_repository/spec/remove_spec.rb +1 -1
  159. data/features/yum_repository.feature +3 -1
  160. data/lib/chefspec/api/yum_repository.rb +56 -6
  161. data/lib/chefspec/solo_runner.rb +1 -1
  162. data/lib/chefspec/version.rb +1 -1
  163. data/templates/errors/may_need_to_specify_platform.erb +1 -1
  164. metadata +8 -4
  165. data/examples/yum_repository/recipes/make_cache.rb +0 -3
@@ -6,7 +6,7 @@ RSpec.configure do |config|
6
6
  end
7
7
 
8
8
  describe 'server::render_with_cached' do
9
- cached(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
9
+ cached(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
10
10
 
11
11
  it 'does not cache file requests' do
12
12
  expect(chef_run).to render_file('/tmp/file')
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'server::role' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new do |_node, server|
5
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |_node, server|
6
6
  server.create_role('webserver')
7
7
  end.converge(described_recipe)
8
8
  end
@@ -33,7 +33,7 @@ describe 'server::search' do
33
33
  end
34
34
 
35
35
  let(:chef_run) do
36
- ChefSpec::ServerRunner.new do |node, server|
36
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node, server|
37
37
  node.normal['bar'] = true
38
38
  server.update_node(node)
39
39
 
@@ -47,7 +47,7 @@ describe 'server::search' do
47
47
  it 'finds all nodes with the bar attribute' do
48
48
  expect(chef_run).to write_log('nodes with an attribute')
49
49
  .with_message(<<-EOH.gsub(/^ {8}/, '').strip)
50
- chefspec, FQDN: chefspec.local, hostname: chefspec
50
+ chefspec, FQDN: fauxhai.local, hostname: Fauxhai
51
51
  node_1, FQDN: node_1.example.com, hostname: node_1
52
52
  node_2, FQDN: node_2.example.com, hostname: node_2
53
53
  node_3, FQDN: node_3.example.com, hostname: node_3
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'service::disable' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'disables a service with an explicit action' do
7
7
  expect(chef_run).to disable_service('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'service::enable' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'enables a service with an explicit action' do
7
7
  expect(chef_run).to enable_service('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'service::reload' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'reloads a service with an explicit action' do
7
7
  expect(chef_run).to reload_service('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'service::restart' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'restarts a service with an explicit action' do
7
7
  expect(chef_run).to restart_service('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'service::start' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'starts a service with an explicit action' do
7
7
  expect(chef_run).to start_service('explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'service::stop' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'stops a service with an explicit action' do
7
7
  expect(chef_run).to stop_service('explicit_action')
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  ChefSpec.define_matcher(:state_attrs_lwrp)
4
4
 
5
5
  describe 'state_attrs::default' do
6
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
6
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
7
7
  let(:lwrp) { chef_run.state_attrs_lwrp('name') }
8
8
 
9
9
  it 'has the correct state attributes' do
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'step_into::default' do
4
4
  context 'without :step_into' do
5
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
5
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
6
6
 
7
7
  it 'does not execute the LWRPs action' do
8
8
  expect(chef_run).to_not write_log('message')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'stub_command::default' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  context 'when the command is not stubbed' do
7
7
  it 'raises an exception' do
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subscribes::before' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
  let(:service) { chef_run.service('receiving_resource') }
6
6
 
7
7
  it 'subscribes to the template creation' do
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subscribes::chained' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
  let(:service) { chef_run.service('service') }
6
6
  let(:log) { chef_run.log('log') }
7
7
 
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subscribes::default' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
  let(:service) { chef_run.service('receiving_resource') }
6
6
 
7
7
  it 'subscribes to the template creation' do
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subscribes::delayed' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
  let(:service) { chef_run.service('receiving_resource') }
6
6
 
7
7
  it 'subscribes to the template creation' do
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subscribes::immediately' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
  let(:service) { chef_run.service('receiving_resource') }
6
6
 
7
7
  it 'sends a notification to the service' do
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subversion::checkout' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'checkouts a subversion with an explicit action' do
7
7
  expect(chef_run).to checkout_subversion('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subversion::export' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'exports a subversion with an explicit action' do
7
7
  expect(chef_run).to export_subversion('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subversion::force_export' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'force_exports a subversion with an explicit action' do
7
7
  expect(chef_run).to force_export_subversion('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'subversion::sync' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'syncs a subversion with the default action' do
7
7
  expect(chef_run).to sync_subversion('/tmp/default_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'template::create_if_missing' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'creates a template with an explicit action' do
7
7
  expect(chef_run).to create_template_if_missing('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'template::create' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'creates a template with the default action' do
7
7
  expect(chef_run).to create_template('/tmp/default_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'template::delete' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'deletes a template with an explicit action' do
7
7
  expect(chef_run).to delete_template('/tmp/explicit_action')
@@ -1,7 +1,7 @@
1
1
  require 'chefspec'
2
2
 
3
3
  describe 'template::touch' do
4
- let(:chef_run) { ChefSpec::ServerRunner.converge(described_recipe) }
4
+ let(:chef_run) { ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) }
5
5
 
6
6
  it 'touches a template with an explicit action' do
7
7
  expect(chef_run).to touch_template('/tmp/explicit_action')
@@ -2,7 +2,7 @@ require 'chefspec'
2
2
 
3
3
  describe 'use_inline_resources::default' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(step_into: ['use_inline_resources_lwrp'])
5
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04', step_into: ['use_inline_resources_lwrp'])
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
@@ -2,8 +2,8 @@ require 'chefspec'
2
2
 
3
3
  describe 'user::create' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04')
6
- .converge(described_recipe)
5
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'creates a user with the default action' do
@@ -2,8 +2,8 @@ require 'chefspec'
2
2
 
3
3
  describe 'user::lock' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04')
6
- .converge(described_recipe)
5
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'locks a user with an explicit action' do
@@ -2,8 +2,8 @@ require 'chefspec'
2
2
 
3
3
  describe 'user::manage' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04')
6
- .converge(described_recipe)
5
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'manages a user with an explicit action' do
@@ -2,8 +2,8 @@ require 'chefspec'
2
2
 
3
3
  describe 'user::modify' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04')
6
- .converge(described_recipe)
5
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'modifys a user with an explicit action' do
@@ -2,8 +2,8 @@ require 'chefspec'
2
2
 
3
3
  describe 'user::remove' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04')
6
- .converge(described_recipe)
5
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'removes a user with an explicit action' do
@@ -2,8 +2,8 @@ require 'chefspec'
2
2
 
3
3
  describe 'user::unlock' do
4
4
  let(:chef_run) do
5
- ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04')
6
- .converge(described_recipe)
5
+ ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'unlocks a user with an explicit action' do
@@ -0,0 +1,8 @@
1
+ # :add is the legacy action from yum cookbook < 3.0
2
+ # :create should be used instead, but both are valid
3
+ # so we'll support both here (for now)
4
+
5
+ yum_repository 'explicit_add_action' do
6
+ baseurl 'some_url'
7
+ action :add
8
+ end
@@ -0,0 +1,3 @@
1
+ yum_repository 'explicit_delete_action' do
2
+ action :delete
3
+ end
@@ -0,0 +1,3 @@
1
+ yum_repository 'explicit_makecache_action' do
2
+ action :makecache
3
+ end
@@ -1,3 +1,7 @@
1
+ # :remove is the legacy action from yum cookbook < 3.0
2
+ # :delete should be used instead, but both are valid
3
+ # so we'll support both here (for now)
4
+
1
5
  yum_repository 'explicit_remove_action' do
2
6
  action :remove
3
7
  end
@@ -0,0 +1,12 @@
1
+ require 'chefspec'
2
+
3
+ describe 'yum_repository::add' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'centos', version: '7.2.1511')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'creates a yum_repository with add action' do
10
+ expect(chef_run).to add_yum_repository('explicit_add_action')
11
+ end
12
+ end
@@ -11,7 +11,7 @@ describe 'yum_repository::create' do
11
11
  expect(chef_run).to_not create_yum_repository('not_default_action')
12
12
  end
13
13
 
14
- it 'creates a yum_repository with an explicit action' do
14
+ it 'creates a yum_repository with create action' do
15
15
  expect(chef_run).to create_yum_repository('explicit_action')
16
16
  end
17
17
  end
@@ -0,0 +1,12 @@
1
+ require 'chefspec'
2
+
3
+ describe 'yum_repository::delete' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'centos', version: '7.2.1511')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'removes a yum_repository with delete action' do
10
+ expect(chef_run).to delete_yum_repository('explicit_delete_action')
11
+ end
12
+ end
@@ -1,12 +1,12 @@
1
1
  require 'chefspec'
2
2
 
3
- describe 'yum_repository::make_cache' do
3
+ describe 'yum_repository::makecache' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'centos', version: '7.2.1511')
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'makes cache for a yum_repository' do
10
- expect(chef_run).to make_cache_yum_repository('explicit_make_cache_action')
10
+ expect(chef_run).to makecache_yum_repository('explicit_makecache_action')
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ describe 'yum_repository::remove' do
6
6
  .converge(described_recipe)
7
7
  end
8
8
 
9
- it 'removes a yum_repository with default action' do
9
+ it 'removes a yum_repository with remove action' do
10
10
  expect(chef_run).to remove_yum_repository('explicit_remove_action')
11
11
  end
12
12
  end
@@ -23,5 +23,7 @@ Feature: The yum_repository matcher
23
23
  Examples:
24
24
  | Matcher |
25
25
  | create |
26
+ | delete |
27
+ | add |
26
28
  | remove |
27
- | make_cache |
29
+ | makecache |
@@ -5,7 +5,7 @@ module ChefSpec::API
5
5
 
6
6
  #
7
7
  # Assert that a +yum_repository+ resource exists in the Chef run with the
8
- # action +:create+. Given a Chef Recipe that adds "epel" as an
8
+ # action +:create+. Given a Chef Recipe that creates "epel" as an
9
9
  # +yum_repository+:
10
10
  #
11
11
  # yum_repository 'epel' do
@@ -29,6 +29,56 @@ module ChefSpec::API
29
29
  resource_name)
30
30
  end
31
31
 
32
+ #
33
+ # Assert that a +yum_repository+ resource exists in the Chef run with the
34
+ # action +:add+. Given a Chef Recipe that adds "epel" as an
35
+ # +yum_repository+:
36
+ #
37
+ # yum_repository 'epel' do
38
+ # baseurl "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-#{node['platform_version'].to_i}&arch=$basearch"
39
+ # description 'Extra Packages for $releasever - $basearch'
40
+ # action :add
41
+ # end
42
+ #
43
+ # The Examples section demonstrates the different ways to test an
44
+ # +yum_repository+ resource with ChefSpec.
45
+ #
46
+ # @example Assert that an +yum_repository+ was added
47
+ # expect(chef_run).to add_yum_repository('epel')
48
+ # @param [String, Regex] resource_name
49
+ # the name of the resource to match
50
+ #
51
+ # @return [ChefSpec::Matchers::ResourceMatcher]
52
+
53
+ def add_yum_repository(resource_name)
54
+ ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :add,
55
+ resource_name)
56
+ end
57
+
58
+ #
59
+ # Assert that a +yum_repository+ resource exists in the Chef run with the
60
+ # action +:delete+. Given a Chef Recipe that deletes "epel" as an
61
+ # +yum_repository+:
62
+ #
63
+ # yum_repository 'epel' do
64
+ # action :delete
65
+ # end
66
+ #
67
+ # The Examples section demonstrates the different ways to test an
68
+ # +yum_repository+ resource with ChefSpec.
69
+ #
70
+ # @example Assert that an +yum_repository+ was deleted
71
+ # expect(chef_run).to delete_yum_repository('epel')
72
+ # @param [String, Regex] resource_name
73
+ # the name of the resource to match
74
+ #
75
+ # @return [ChefSpec::Matchers::ResourceMatcher]
76
+
77
+ def delete_yum_repository(resource_name)
78
+ ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :delete,
79
+ resource_name)
80
+ end
81
+
32
82
  #
33
83
  # Assert that a +yum_repository+ resource exists in the Chef run with the
34
84
  # action +:remove+. Given a Chef Recipe that removes "epel" as an
@@ -55,25 +105,25 @@ module ChefSpec::API
55
105
 
56
106
  #
57
107
  # Assert that a +yum_repository+ resource exists in the Chef run with the
58
- # action +:make_cache+. Given a Chef Recipe that makes cache for "epel" as
108
+ # action +:makecache+. Given a Chef Recipe that makes cache for "epel" as
59
109
  # a +yum_repository+:
60
110
  #
61
111
  # yum_repository 'epel' do
62
- # action :make_cache
112
+ # action :makecache
63
113
  # end
64
114
  #
65
115
  # The Examples section demonstrates the different ways to test an
66
116
  # +yum_repository+ resource with ChefSpec.
67
117
  #
68
118
  # @example Assert that an +yum_repository+ was make cache'd
69
- # expect(chef_run).to make_cache_yum_repository('epel')
119
+ # expect(chef_run).to makecache_yum_repository('epel')
70
120
  # @param [String, Regex] resource_name
71
121
  # the name of the resource to match
72
122
  #
73
123
  # @return [ChefSpec::Matchers::ResourceMatcher]
74
124
 
75
- def make_cache_yum_repository(resource_name)
76
- ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :make_cache,
125
+ def makecache_yum_repository(resource_name)
126
+ ChefSpec::Matchers::ResourceMatcher.new(:yum_repository, :makecache,
77
127
  resource_name)
78
128
  end
79
129
  end
@@ -121,7 +121,7 @@ module ChefSpec
121
121
  end
122
122
 
123
123
  # Allow stubbing/mocking after the cookbook has been compiled but before the converge
124
- yield if block_given?
124
+ yield node if block_given?
125
125
 
126
126
  @converging = true
127
127
  converge_val = @client.converge(@run_context)
@@ -1,3 +1,3 @@
1
1
  module ChefSpec
2
- VERSION = '5.1.0'
2
+ VERSION = '5.2.0'
3
3
  end
@@ -13,7 +13,7 @@ options.
13
13
  You can specify the platform and version you would like ChefSpec to act like
14
14
  by specifying the platform and version like so:
15
15
 
16
- ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04')
16
+ ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04')
17
17
 
18
18
  You can read more information in ChefSpec's README or the Fauxhai project:
19
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chefspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-14 00:00:00.000000000 Z
12
+ date: 2016-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -578,11 +578,15 @@ files:
578
578
  - examples/yum_package/spec/purge_spec.rb
579
579
  - examples/yum_package/spec/remove_spec.rb
580
580
  - examples/yum_package/spec/upgrade_spec.rb
581
+ - examples/yum_repository/recipes/add.rb
581
582
  - examples/yum_repository/recipes/create.rb
582
- - examples/yum_repository/recipes/make_cache.rb
583
+ - examples/yum_repository/recipes/delete.rb
584
+ - examples/yum_repository/recipes/makecache.rb
583
585
  - examples/yum_repository/recipes/remove.rb
586
+ - examples/yum_repository/spec/add_spec.rb
584
587
  - examples/yum_repository/spec/create_spec.rb
585
- - examples/yum_repository/spec/make_cache_spec.rb
588
+ - examples/yum_repository/spec/delete_spec.rb
589
+ - examples/yum_repository/spec/makecache_spec.rb
586
590
  - examples/yum_repository/spec/remove_spec.rb
587
591
  - features/apt_package.feature
588
592
  - features/apt_repository.feature
@@ -1,3 +0,0 @@
1
- yum_repository 'explicit_make_cache_action' do
2
- action :make_cache
3
- end