chefspec 5.4.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -2
  3. data/CHANGELOG.md +12 -1
  4. data/README.md +17 -3
  5. data/chefspec.gemspec +2 -3
  6. data/examples/apt_package/spec/install_spec.rb +1 -1
  7. data/examples/apt_package/spec/purge_spec.rb +1 -1
  8. data/examples/apt_package/spec/reconfig_spec.rb +1 -1
  9. data/examples/apt_package/spec/remove_spec.rb +1 -1
  10. data/examples/apt_package/spec/upgrade_spec.rb +1 -1
  11. data/examples/apt_repository/spec/add_spec.rb +1 -1
  12. data/examples/apt_repository/spec/remove_spec.rb +1 -1
  13. data/examples/apt_update/spec/periodic_spec.rb +1 -1
  14. data/examples/apt_update/spec/update_spec.rb +1 -1
  15. data/examples/batch/spec/run_spec.rb +1 -1
  16. data/examples/cab_package/recipes/install.rb +13 -0
  17. data/examples/cab_package/recipes/remove.rb +13 -0
  18. data/examples/cab_package/spec/install_spec.rb +26 -0
  19. data/examples/cab_package/spec/remove_spec.rb +22 -0
  20. data/examples/chocolatey_package/spec/install_spec.rb +1 -1
  21. data/examples/chocolatey_package/spec/remove_spec.rb +1 -1
  22. data/examples/chocolatey_package/spec/upgrade_spec.rb +1 -1
  23. data/examples/dnf_package/recipes/install.rb +13 -0
  24. data/examples/dnf_package/recipes/purge.rb +13 -0
  25. data/examples/dnf_package/recipes/remove.rb +13 -0
  26. data/examples/dnf_package/recipes/upgrade.rb +13 -0
  27. data/examples/dnf_package/spec/install_spec.rb +26 -0
  28. data/examples/dnf_package/spec/purge_spec.rb +22 -0
  29. data/examples/dnf_package/spec/remove_spec.rb +22 -0
  30. data/examples/dnf_package/spec/upgrade_spec.rb +22 -0
  31. data/examples/dpkg_package/spec/install_spec.rb +1 -1
  32. data/examples/dpkg_package/spec/purge_spec.rb +1 -1
  33. data/examples/dpkg_package/spec/remove_spec.rb +1 -1
  34. data/examples/dsc_resource/spec/run_spec.rb +4 -4
  35. data/examples/dsc_script/spec/run_spec.rb +1 -1
  36. data/examples/env/spec/create_spec.rb +1 -1
  37. data/examples/env/spec/delete_spec.rb +1 -1
  38. data/examples/env/spec/modify_spec.rb +1 -1
  39. data/examples/freebsd_package/spec/install_spec.rb +1 -1
  40. data/examples/freebsd_package/spec/remove_spec.rb +1 -1
  41. data/examples/ips_package/spec/install_spec.rb +1 -1
  42. data/examples/ips_package/spec/remove_spec.rb +1 -1
  43. data/examples/ips_package/spec/upgrade_spec.rb +1 -1
  44. data/examples/msu_package/recipes/install.rb +13 -0
  45. data/examples/msu_package/recipes/remove.rb +13 -0
  46. data/examples/msu_package/spec/install_spec.rb +26 -0
  47. data/examples/msu_package/spec/remove_spec.rb +22 -0
  48. data/examples/pacman_package/spec/install_spec.rb +1 -1
  49. data/examples/pacman_package/spec/purge_spec.rb +1 -1
  50. data/examples/pacman_package/spec/remove_spec.rb +1 -1
  51. data/examples/pacman_package/spec/upgrade_spec.rb +1 -1
  52. data/examples/portage_package/spec/install_spec.rb +1 -1
  53. data/examples/portage_package/spec/purge_spec.rb +1 -1
  54. data/examples/portage_package/spec/remove_spec.rb +1 -1
  55. data/examples/portage_package/spec/upgrade_spec.rb +1 -1
  56. data/examples/powershell_script/spec/run_spec.rb +1 -1
  57. data/examples/registry_key/spec/create_if_missing_spec.rb +1 -1
  58. data/examples/registry_key/spec/create_spec.rb +1 -1
  59. data/examples/registry_key/spec/delete_key_spec.rb +1 -1
  60. data/examples/registry_key/spec/delete_spec.rb +1 -1
  61. data/examples/roles/roles/role.rb +2 -2
  62. data/examples/rpm_package/spec/install_spec.rb +1 -1
  63. data/examples/rpm_package/spec/remove_spec.rb +1 -1
  64. data/examples/rpm_package/spec/upgrade_spec.rb +1 -1
  65. data/examples/server/spec/data_bag_spec.rb +9 -11
  66. data/examples/smartos_package/spec/install_spec.rb +1 -1
  67. data/examples/smartos_package/spec/remove_spec.rb +1 -1
  68. data/examples/smartos_package/spec/upgrade_spec.rb +1 -1
  69. data/examples/solaris_package/spec/install_spec.rb +1 -1
  70. data/examples/solaris_package/spec/remove_spec.rb +1 -1
  71. data/examples/step_into/spec/default_spec.rb +2 -2
  72. data/examples/use_inline_resources/spec/default_spec.rb +1 -1
  73. data/examples/windows_package/spec/install_spec.rb +1 -1
  74. data/examples/windows_package/spec/remove_spec.rb +1 -1
  75. data/examples/windows_service/spec/configure_startup_spec.rb +1 -1
  76. data/examples/windows_service/spec/disable_spec.rb +1 -1
  77. data/examples/windows_service/spec/enable_spec.rb +1 -1
  78. data/examples/windows_service/spec/reload_spec.rb +1 -1
  79. data/examples/windows_service/spec/restart_spec.rb +1 -1
  80. data/examples/windows_service/spec/start_spec.rb +1 -1
  81. data/examples/windows_service/spec/stop_spec.rb +1 -1
  82. data/examples/yum_package/spec/install_spec.rb +1 -1
  83. data/examples/yum_package/spec/purge_spec.rb +1 -1
  84. data/examples/yum_package/spec/remove_spec.rb +1 -1
  85. data/examples/yum_package/spec/upgrade_spec.rb +1 -1
  86. data/examples/yum_repository/spec/add_spec.rb +1 -1
  87. data/examples/yum_repository/spec/create_spec.rb +1 -1
  88. data/examples/yum_repository/spec/delete_spec.rb +1 -1
  89. data/examples/yum_repository/spec/makecache_spec.rb +1 -1
  90. data/examples/yum_repository/spec/remove_spec.rb +1 -1
  91. data/features/cab_package.feature +21 -0
  92. data/features/dnf_package.feature +26 -0
  93. data/features/msu_package.feature +23 -0
  94. data/features/support/env.rb +8 -0
  95. data/lib/chefspec.rb +0 -1
  96. data/lib/chefspec/api.rb +3 -0
  97. data/lib/chefspec/api/cab_package.rb +80 -0
  98. data/lib/chefspec/api/dnf_package.rb +154 -0
  99. data/lib/chefspec/api/msu_package.rb +81 -0
  100. data/lib/chefspec/rspec.rb +1 -0
  101. data/lib/chefspec/server_methods.rb +4 -35
  102. data/lib/chefspec/server_runner.rb +2 -42
  103. data/lib/chefspec/version.rb +1 -1
  104. data/lib/chefspec/zero_server.rb +139 -0
  105. metadata +31 -6
  106. data/lib/chefspec/chef_backwards_compat.rb +0 -79
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 211571e6c3653dfe0f5a14afc11aa7dc345ef5e2
4
- data.tar.gz: e26799c5d30d08c00e23589efcff3ce68c64ca2f
3
+ metadata.gz: c39538d26c07878521a8a68a1e8b488c80901e1d
4
+ data.tar.gz: f95025605f2aaa4d047cb2f193fb6575e9e55144
5
5
  SHA512:
6
- metadata.gz: 5837c6e05f8f156084ca693bcdbe6942817ccb6be32c6b93aa9f56ab1aca5e28db6a1dcc6abae66b89399362f38728d96e3fe13a5a111370ae8a1ebe5f249992
7
- data.tar.gz: e7ba13ba29067d4f13c550bea471d7ff017416470f83247d6c131ca3868d1992315041eae4371121132f6d88d11b4fc086309d8280776bb7acc76b2b73d392d5
6
+ metadata.gz: 24ca89915326c5474ed8802aa2d34c5777661e40d2cfcde76ada3ecf44f131968efd41a7c3f373ac41d4b6f6c0b8c4149b24adac82cd937b05541e80487d5a2d
7
+ data.tar.gz: 15caa99f8225ec1f17186bab5d7b895a9a1febdec0c3bc050d2077da69948ef9827fcedd6c46d3812acc5a128bc22e099ae0f2a8fc450ab9308e93bcff272d75
data/.travis.yml CHANGED
@@ -6,8 +6,7 @@ before_install:
6
6
  - gem install bundler
7
7
 
8
8
  rvm:
9
- - 2.1.9
10
- - 2.2.5
9
+ - 2.2.6
11
10
 
12
11
  branches:
13
12
  only:
@@ -19,6 +18,11 @@ gemfile: gemfiles/chefspec.gemfile
19
18
 
20
19
  env:
21
20
  - CHEF_VERSION=master
21
+ - CHEF_VERSION=12.18.31
22
+ - CHEF_VERSION=12.17.44
23
+ - CHEF_VERSION=12.16.42
24
+ - CHEF_VERSION=12.15.19
25
+ - CHEF_VERSION=12.14.89
22
26
  - CHEF_VERSION=12.13.37
23
27
  - CHEF_VERSION=12.12.15
24
28
  - CHEF_VERSION=12.11.18
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG for ChefSpec
2
2
 
3
+ ## 6.0.0 (February 22, 2017)
4
+
5
+ BREAKING CHANGES
6
+
7
+ ChefSpec now requires Ruby 2.2 or later.
8
+
9
+ IMPROVEMENTS
10
+
11
+ - Improve ServerRunner speed and reduce process hangs by using a single stand-alone chef-zero server.
12
+ - Add configuration value to dictate whether cookbooks are re-uploaded before every test context.
13
+ - Added matchers for dnf_package, msu_package, and cab_package
14
+
3
15
  ## 5.4.0 (February 9, 2017)
4
16
 
5
17
  IMPROVEMENTS
@@ -10,7 +22,6 @@ UPDATES
10
22
 
11
23
  - While Chef 12.0 - 12.5 are still supported, they are no longer being tested.
12
24
 
13
-
14
25
  ## 5.3.0 (October 29, 2016)
15
26
 
16
27
  IMPROVEMENTS
data/README.md CHANGED
@@ -92,9 +92,6 @@ RSpec.configure do |config|
92
92
 
93
93
  # Specify the operating version to mock Ohai data from (default: nil)
94
94
  config.version = '14.04'
95
-
96
- # When using ChefSpec::ServerRunner, specify the data storage method (options: in_memory, on_disk; default: in_memory)
97
- config.server_runner_data_store = :on_disk
98
95
  end
99
96
  ```
100
97
 
@@ -122,6 +119,23 @@ ChefSpec::SoloRunner.new(log_level: :debug).converge(described_recipe)
122
119
 
123
120
  **NOTE** You do not _need_ to specify a platform and version to use ChefSpec. However, some cookbooks may rely on [Ohai](http://github.com/chef/ohai) data that ChefSpec cannot not automatically generate. Specifying the `platform` and `version` keys instructs ChefSpec to load stubbed Ohai attributes from another platform using [fauxhai](https://github.com/customink/fauxhai).
124
121
 
122
+ ### ChefZero Server
123
+
124
+ The `ServerRunner` uses a [chef-zero](https://github.com/chef/chef-zero) instance as a stand-in for a full Chef Server. The instance is created at the initiation of the ChefSpec suite and is terminated at its completion. In between each test the state of the ChefZero server is completely reset.
125
+
126
+ ```ruby
127
+ RSpec.configure do |config|
128
+ # When using ChefSpec::ServerRunner, specify the data storage method (options: in_memory, on_disk; default: in_memory)
129
+ # If you are in a low-memory environment, setting this value to :on_disk may improve speed and/or reliability.
130
+ config.server_runner_data_store = :on_disk
131
+
132
+ # Whether or not to clear the cookbooks on the ChefZero instance in-between each test (default: true)
133
+ # For most people, not clearing the cookbooks will drastically improve test execution time. This is a
134
+ # good option for people who are using chefspec within the context of a single Berksfile or Policyfile.
135
+ config.server_runner_clear_cookbooks = false
136
+ end
137
+ ```
138
+
125
139
  ### Berkshelf
126
140
 
127
141
  If you are using Berkshelf, simply require `chefspec/berkshelf` in your `spec_helper` after requiring `chefspec`:
data/chefspec.gemspec CHANGED
@@ -23,15 +23,14 @@ Gem::Specification.new do |s|
23
23
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
24
24
  s.require_paths = ['lib']
25
25
 
26
- # ChefSpec requires Ruby 2.1+ since ChefDK uses 2.1+ (depending on version)
27
- s.required_ruby_version = '>= 2.1'
26
+ s.required_ruby_version = '>= 2.2'
28
27
 
29
28
  s.add_dependency 'chef', '>= 12.0'
30
29
  s.add_dependency 'fauxhai', '~> 3.6'
31
30
  s.add_dependency 'rspec', '~> 3.0'
32
31
 
33
32
  # Development Dependencies
34
- s.add_development_dependency 'rake', '< 12.0'
33
+ s.add_development_dependency 'rake', '< 13.0'
35
34
  s.add_development_dependency 'redcarpet', '~> 3.3'
36
35
  s.add_development_dependency 'yard', '~> 0.8'
37
36
 
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_package::install' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'installs a apt_package with the default action' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_package::purge' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'purges a apt_package with an explicit action' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_package::reconfig' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'reconfigs a apt_package with an explicit action' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_package::remove' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'removes a apt_package with an explicit action' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_package::upgrade' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'upgrades a apt_package with an explicit action' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_repository::add' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'adds a apt_repository with default action' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_repository::remove' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'removes a apt_repository with default action' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_update::periodic' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'updates apt with default action' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'apt_update::update' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'updates apt repo' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'batch::run' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'runs a batch with the default action' do
@@ -0,0 +1,13 @@
1
+ cab_package 'default_action'
2
+
3
+ cab_package 'explicit_action' do
4
+ action :install
5
+ end
6
+
7
+ cab_package 'with_attributes' do
8
+ version '1.2.3'
9
+ end
10
+
11
+ cab_package 'specifying the identity attribute' do
12
+ package_name 'identity_attribute'
13
+ end
@@ -0,0 +1,13 @@
1
+ cab_package 'explicit_action' do
2
+ action :remove
3
+ end
4
+
5
+ cab_package 'with_attributes' do
6
+ version '1.2.3'
7
+ action :remove
8
+ end
9
+
10
+ cab_package 'specifying the identity attribute' do
11
+ package_name 'identity_attribute'
12
+ action :remove
13
+ end
@@ -0,0 +1,26 @@
1
+ require 'chefspec'
2
+
3
+ describe 'cab_package::install' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'installs a cab_package with the default action' do
10
+ expect(chef_run).to install_cab_package('default_action')
11
+ expect(chef_run).to_not install_cab_package('not_default_action')
12
+ end
13
+
14
+ it 'installs a cab_package with an explicit action' do
15
+ expect(chef_run).to install_cab_package('explicit_action')
16
+ end
17
+
18
+ it 'installs a cab_package with attributes' do
19
+ expect(chef_run).to install_cab_package('with_attributes').with(version: '1.2.3')
20
+ expect(chef_run).to_not install_cab_package('with_attributes').with(version: '1.2.4')
21
+ end
22
+
23
+ it 'installs a cab_package when specifying the identity attribute' do
24
+ expect(chef_run).to install_cab_package('identity_attribute')
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ require 'chefspec'
2
+
3
+ describe 'cab_package::remove' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'removes a cab_package with an explicit action' do
10
+ expect(chef_run).to remove_cab_package('explicit_action')
11
+ expect(chef_run).to_not remove_cab_package('not_explicit_action')
12
+ end
13
+
14
+ it 'removes a cab_package with attributes' do
15
+ expect(chef_run).to remove_cab_package('with_attributes').with(version: '1.2.3')
16
+ expect(chef_run).to_not remove_cab_package('with_attributes').with(version: '1.2.4')
17
+ end
18
+
19
+ it 'removes a cab_package when specifying the identity attribute' do
20
+ expect(chef_run).to remove_cab_package('identity_attribute')
21
+ end
22
+ end
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'chocolatey_package::install' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'installs a package' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'chocolatey_package::remove' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'removes a package' do
@@ -3,7 +3,7 @@ require 'chefspec'
3
3
  describe 'chocolatey_package::upgrade' do
4
4
  let(:chef_run) do
5
5
  ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
6
- .converge(described_recipe)
6
+ .converge(described_recipe)
7
7
  end
8
8
 
9
9
  it 'upgrades a package' do
@@ -0,0 +1,13 @@
1
+ dnf_package 'default_action'
2
+
3
+ dnf_package 'explicit_action' do
4
+ action :install
5
+ end
6
+
7
+ dnf_package 'with_attributes' do
8
+ version '1.0.0'
9
+ end
10
+
11
+ dnf_package 'specifying the identity attribute' do
12
+ package_name 'identity_attribute'
13
+ end
@@ -0,0 +1,13 @@
1
+ dnf_package 'explicit_action' do
2
+ action :purge
3
+ end
4
+
5
+ dnf_package 'with_attributes' do
6
+ version '1.0.0'
7
+ action :purge
8
+ end
9
+
10
+ dnf_package 'specifying the identity attribute' do
11
+ package_name 'identity_attribute'
12
+ action :purge
13
+ end
@@ -0,0 +1,13 @@
1
+ dnf_package 'explicit_action' do
2
+ action :remove
3
+ end
4
+
5
+ dnf_package 'with_attributes' do
6
+ version '1.0.0'
7
+ action :remove
8
+ end
9
+
10
+ dnf_package 'specifying the identity attribute' do
11
+ package_name 'identity_attribute'
12
+ action :remove
13
+ end
@@ -0,0 +1,13 @@
1
+ dnf_package 'explicit_action' do
2
+ action :upgrade
3
+ end
4
+
5
+ dnf_package 'with_attributes' do
6
+ version '1.0.0'
7
+ action :upgrade
8
+ end
9
+
10
+ dnf_package 'specifying the identity attribute' do
11
+ package_name 'identity_attribute'
12
+ action :upgrade
13
+ end
@@ -0,0 +1,26 @@
1
+ require 'chefspec'
2
+
3
+ describe 'dnf_package::install' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'fedora', version: '25')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'installs a dnf_package with the default action' do
10
+ expect(chef_run).to install_dnf_package('default_action')
11
+ expect(chef_run).to_not install_dnf_package('not_default_action')
12
+ end
13
+
14
+ it 'installs a dnf_package with an explicit action' do
15
+ expect(chef_run).to install_dnf_package('explicit_action')
16
+ end
17
+
18
+ it 'installs a dnf_package with attributes' do
19
+ expect(chef_run).to install_dnf_package('with_attributes').with(version: '1.0.0')
20
+ expect(chef_run).to_not install_dnf_package('with_attributes').with(version: '1.2.3')
21
+ end
22
+
23
+ it 'installs a dnf_package when specifying the identity attribute' do
24
+ expect(chef_run).to install_dnf_package('identity_attribute')
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ require 'chefspec'
2
+
3
+ describe 'dnf_package::purge' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'fedora', version: '25')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'purges a dnf_package with an explicit action' do
10
+ expect(chef_run).to purge_dnf_package('explicit_action')
11
+ expect(chef_run).to_not purge_dnf_package('not_explicit_action')
12
+ end
13
+
14
+ it 'purges a dnf_package with attributes' do
15
+ expect(chef_run).to purge_dnf_package('with_attributes').with(version: '1.0.0')
16
+ expect(chef_run).to_not purge_dnf_package('with_attributes').with(version: '1.2.3')
17
+ end
18
+
19
+ it 'purges a dnf_package when specifying the identity attribute' do
20
+ expect(chef_run).to purge_dnf_package('identity_attribute')
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ require 'chefspec'
2
+
3
+ describe 'dnf_package::remove' do
4
+ let(:chef_run) do
5
+ ChefSpec::ServerRunner.new(platform: 'fedora', version: '25')
6
+ .converge(described_recipe)
7
+ end
8
+
9
+ it 'removes a dnf_package with an explicit action' do
10
+ expect(chef_run).to remove_dnf_package('explicit_action')
11
+ expect(chef_run).to_not remove_dnf_package('not_explicit_action')
12
+ end
13
+
14
+ it 'removes a dnf_package with attributes' do
15
+ expect(chef_run).to remove_dnf_package('with_attributes').with(version: '1.0.0')
16
+ expect(chef_run).to_not remove_dnf_package('with_attributes').with(version: '1.2.3')
17
+ end
18
+
19
+ it 'removes a dnf_package when specifying the identity attribute' do
20
+ expect(chef_run).to remove_dnf_package('identity_attribute')
21
+ end
22
+ end