chefspec 5.2.0 → 5.3.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 (119) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +3 -3
  4. data/chefspec.gemspec +1 -1
  5. data/examples/bff_package/recipes/install.rb +13 -0
  6. data/examples/bff_package/recipes/purge.rb +13 -0
  7. data/examples/bff_package/recipes/remove.rb +13 -0
  8. data/examples/bff_package/recipes/upgrade.rb +13 -0
  9. data/examples/bff_package/spec/install_spec.rb +23 -0
  10. data/examples/bff_package/spec/purge_spec.rb +19 -0
  11. data/examples/bff_package/spec/remove_spec.rb +19 -0
  12. data/examples/bff_package/spec/upgrade_spec.rb +19 -0
  13. data/examples/homebrew_package/recipes/install.rb +13 -0
  14. data/examples/homebrew_package/recipes/purge.rb +13 -0
  15. data/examples/homebrew_package/recipes/remove.rb +13 -0
  16. data/examples/homebrew_package/recipes/upgrade.rb +13 -0
  17. data/examples/homebrew_package/spec/install_spec.rb +23 -0
  18. data/examples/homebrew_package/spec/purge_spec.rb +19 -0
  19. data/examples/homebrew_package/spec/remove_spec.rb +19 -0
  20. data/examples/homebrew_package/spec/upgrade_spec.rb +19 -0
  21. data/examples/launchd/recipes/create.rb +5 -0
  22. data/examples/launchd/recipes/create_if_missing.rb +3 -0
  23. data/examples/launchd/recipes/delete.rb +3 -0
  24. data/examples/launchd/recipes/disable.rb +3 -0
  25. data/examples/launchd/recipes/enable.rb +3 -0
  26. data/examples/launchd/spec/create_if_missing_spec.rb +10 -0
  27. data/examples/launchd/spec/create_spec.rb +14 -0
  28. data/examples/launchd/spec/delete_spec.rb +10 -0
  29. data/examples/launchd/spec/disable_spec.rb +10 -0
  30. data/examples/launchd/spec/enable_spec.rb +10 -0
  31. data/examples/openbsd_package/recipes/install.rb +13 -0
  32. data/examples/openbsd_package/recipes/purge.rb +13 -0
  33. data/examples/openbsd_package/recipes/remove.rb +13 -0
  34. data/examples/openbsd_package/recipes/upgrade.rb +13 -0
  35. data/examples/openbsd_package/spec/install_spec.rb +23 -0
  36. data/examples/openbsd_package/spec/purge_spec.rb +19 -0
  37. data/examples/openbsd_package/spec/remove_spec.rb +19 -0
  38. data/examples/openbsd_package/spec/upgrade_spec.rb +19 -0
  39. data/examples/osx_profile/recipes/install.rb +8 -0
  40. data/examples/osx_profile/recipes/remove.rb +8 -0
  41. data/examples/osx_profile/spec/install_spec.rb +15 -0
  42. data/examples/osx_profile/spec/remove_spec.rb +13 -0
  43. data/examples/paludis_package/recipes/install.rb +13 -0
  44. data/examples/paludis_package/recipes/purge.rb +13 -0
  45. data/examples/paludis_package/recipes/remove.rb +13 -0
  46. data/examples/paludis_package/recipes/upgrade.rb +13 -0
  47. data/examples/paludis_package/spec/install_spec.rb +23 -0
  48. data/examples/paludis_package/spec/purge_spec.rb +19 -0
  49. data/examples/paludis_package/spec/remove_spec.rb +19 -0
  50. data/examples/paludis_package/spec/upgrade_spec.rb +19 -0
  51. data/examples/ruby_block/recipes/create.rb +8 -0
  52. data/examples/ruby_block/spec/create_spec.rb +13 -0
  53. data/examples/script/recipes/run_ksh.rb +13 -0
  54. data/examples/script/spec/run_ksh_spec.rb +23 -0
  55. data/examples/solaris_package/recipes/upgrade.rb +13 -0
  56. data/examples/solaris_package/spec/upgrade_spec.rb +19 -0
  57. data/examples/systemd_unit/recipes/create.rb +3 -0
  58. data/examples/systemd_unit/recipes/delete.rb +3 -0
  59. data/examples/systemd_unit/recipes/disable.rb +3 -0
  60. data/examples/systemd_unit/recipes/enable.rb +3 -0
  61. data/examples/systemd_unit/recipes/mask.rb +3 -0
  62. data/examples/systemd_unit/recipes/reload_or_restart.rb +3 -0
  63. data/examples/systemd_unit/recipes/reload_or_try_restart.rb +3 -0
  64. data/examples/systemd_unit/recipes/restart.rb +3 -0
  65. data/examples/systemd_unit/recipes/start.rb +3 -0
  66. data/examples/systemd_unit/recipes/stop.rb +3 -0
  67. data/examples/systemd_unit/recipes/try_restart.rb +3 -0
  68. data/examples/systemd_unit/recipes/unmask.rb +3 -0
  69. data/examples/systemd_unit/spec/create_spec.rb +10 -0
  70. data/examples/systemd_unit/spec/delete_spec.rb +10 -0
  71. data/examples/systemd_unit/spec/disable_spec.rb +10 -0
  72. data/examples/systemd_unit/spec/enable_spec.rb +10 -0
  73. data/examples/systemd_unit/spec/mask_spec.rb +10 -0
  74. data/examples/systemd_unit/spec/reload_or_restart_spec.rb +10 -0
  75. data/examples/systemd_unit/spec/reload_or_try_restart_spec.rb +10 -0
  76. data/examples/systemd_unit/spec/restart_spec.rb +10 -0
  77. data/examples/systemd_unit/spec/start_spec.rb +10 -0
  78. data/examples/systemd_unit/spec/stop_spec.rb +10 -0
  79. data/examples/systemd_unit/spec/try_restart_spec.rb +10 -0
  80. data/examples/systemd_unit/spec/unmask_spec.rb +10 -0
  81. data/examples/zypper_package/recipes/install.rb +13 -0
  82. data/examples/zypper_package/recipes/purge.rb +13 -0
  83. data/examples/zypper_package/recipes/remove.rb +13 -0
  84. data/examples/zypper_package/recipes/upgrade.rb +13 -0
  85. data/examples/zypper_package/spec/install_spec.rb +23 -0
  86. data/examples/zypper_package/spec/purge_spec.rb +19 -0
  87. data/examples/zypper_package/spec/remove_spec.rb +19 -0
  88. data/examples/zypper_package/spec/upgrade_spec.rb +19 -0
  89. data/features/attributes.feature +1 -1
  90. data/features/bff_package.feature +12 -0
  91. data/features/chocolatey_package.feature +1 -0
  92. data/features/compile_time.feature +1 -1
  93. data/features/dsc_resource.feature +1 -0
  94. data/features/homebrew_package.feature +12 -0
  95. data/features/launchd.feature +23 -0
  96. data/features/openbsd_package.feature +14 -0
  97. data/features/osx_profile.feature +19 -0
  98. data/features/paludis_package.feature +14 -0
  99. data/features/roles.feature +1 -1
  100. data/features/ruby_block.feature +1 -0
  101. data/features/script.feature +8 -0
  102. data/features/solaris_package.feature +1 -0
  103. data/features/systemd_unit.feature +33 -0
  104. data/features/windows_package.feature +1 -0
  105. data/features/zypper_package.feature +18 -0
  106. data/lib/chefspec/api.rb +8 -0
  107. data/lib/chefspec/api/bff_package.rb +154 -0
  108. data/lib/chefspec/api/homebrew_package.rb +154 -0
  109. data/lib/chefspec/api/launchd.rb +151 -0
  110. data/lib/chefspec/api/openbsd_package.rb +155 -0
  111. data/lib/chefspec/api/osx_profile.rb +63 -0
  112. data/lib/chefspec/api/paludis_package.rb +155 -0
  113. data/lib/chefspec/api/ruby_block.rb +31 -0
  114. data/lib/chefspec/api/script.rb +39 -0
  115. data/lib/chefspec/api/solaris_package.rb +37 -0
  116. data/lib/chefspec/api/systemd_unit.rb +353 -0
  117. data/lib/chefspec/api/zypper_package.rb +154 -0
  118. data/lib/chefspec/version.rb +1 -1
  119. metadata +111 -3
@@ -0,0 +1,151 @@
1
+ module ChefSpec::API
2
+ # @since 5.1.0
3
+ module LaunchdMatchers
4
+ ChefSpec.define_matcher :launchd
5
+
6
+ #
7
+ # Assert that a +launchd+ resource exists in the Chef run with the
8
+ # action +:create+. Given a Chef Recipe that creates the launchd daemon
9
+ # "com.chef.every15":
10
+ #
11
+ # launchd 'com.chef.every15' do
12
+ # action :create
13
+ # end
14
+ #
15
+ # The Examples section demonstrates the different ways to test a
16
+ # +launchd+ resource with ChefSpec.
17
+ #
18
+ # @example Assert that a +launchd+ was created
19
+ # expect(chef_run).to create_launchd('com.chef.every15')
20
+ #
21
+ # @example Assert that a +launchd+ was _not_ created
22
+ # expect(chef_run).to_not create_launchd('com.chef.every15')
23
+ #
24
+ #
25
+ # @param [String, Regex] resource_name
26
+ # the name of the resource to match
27
+ #
28
+ # @return [ChefSpec::Matchers::ResourceMatcher]
29
+ #
30
+
31
+ def create_launchd(resource_name)
32
+ ChefSpec::Matchers::ResourceMatcher.new(:launchd, :create, resource_name)
33
+ end
34
+
35
+ #
36
+ # Assert that a +launchd+ resource exists in the Chef run with the
37
+ # action +:create_if_missing+. Given a Chef Recipe that creates if missing
38
+ # the launchd daemon "com.chef.every15":
39
+ #
40
+ # launchd 'com.chef.every15' do
41
+ # action :create_if_missing
42
+ # end
43
+ #
44
+ # The Examples section demonstrates the different ways to test a
45
+ # +launchd+ resource with ChefSpec.
46
+ #
47
+ # @example Assert that a +launchd+ was created
48
+ # expect(chef_run).to create_if_missing_launchd('com.chef.every15')
49
+ #
50
+ # @example Assert that a +launchd+ was _not_ created
51
+ # expect(chef_run).to_not create_if_missing_launchd('com.chef.every15')
52
+ #
53
+ #
54
+ # @param [String, Regex] resource_name
55
+ # the name of the resource to match
56
+ #
57
+ # @return [ChefSpec::Matchers::ResourceMatcher]
58
+ #
59
+
60
+ def create_if_missing_launchd(resource_name)
61
+ ChefSpec::Matchers::ResourceMatcher.new(:launchd, :create_if_missing, resource_name)
62
+ end
63
+
64
+ #
65
+ # Assert that a +launchd+ resource exists in the Chef run with the
66
+ # action +:delete+. Given a Chef Recipe that deletes the launchd daemon
67
+ # "com.chef.every15":
68
+ #
69
+ # launchd 'com.chef.every15' do
70
+ # action :delete
71
+ # end
72
+ #
73
+ # The Examples section demonstrates the different ways to test a
74
+ # +launchd+ resource with ChefSpec.
75
+ #
76
+ # @example Assert that a +launchd+ was deleted
77
+ # expect(chef_run).to delete_launchd('com.chef.every15')
78
+ #
79
+ # @example Assert that a +launchd+ was _not_ deleted
80
+ # expect(chef_run).to_not delete_launchd('com.chef.every15')
81
+ #
82
+ #
83
+ # @param [String, Regex] resource_name
84
+ # the name of the resource to match
85
+ #
86
+ # @return [ChefSpec::Matchers::ResourceMatcher]
87
+ #
88
+
89
+ def delete_launchd(resource_name)
90
+ ChefSpec::Matchers::ResourceMatcher.new(:launchd, :delete, resource_name)
91
+ end
92
+
93
+ #
94
+ # Assert that a +launchd+ resource exists in the Chef run with the
95
+ # action +:disable+. Given a Chef Recipe that disables the launchd daemon
96
+ # "com.chef.every15":
97
+ #
98
+ # launchd 'com.chef.every15' do
99
+ # action :disable
100
+ # end
101
+ #
102
+ # The Examples section demonstrates the different ways to test a
103
+ # +launchd+ resource with ChefSpec.
104
+ #
105
+ # @example Assert that a +launchd+ was disabled
106
+ # expect(chef_run).to disable_launchd('com.chef.every15')
107
+ #
108
+ # @example Assert that a +launchd+ was _not_ disabled
109
+ # expect(chef_run).to_not disable_launchd('com.chef.every15')
110
+ #
111
+ #
112
+ # @param [String, Regex] resource_name
113
+ # the name of the resource to match
114
+ #
115
+ # @return [ChefSpec::Matchers::ResourceMatcher]
116
+ #
117
+
118
+ def disable_launchd(resource_name)
119
+ ChefSpec::Matchers::ResourceMatcher.new(:launchd, :disable, resource_name)
120
+ end
121
+
122
+ #
123
+ # Assert that a +launchd+ resource exists in the Chef run with the
124
+ # action +:enable+. Given a Chef Recipe that enables the launchd daemon
125
+ # "com.chef.every15":
126
+ #
127
+ # launchd 'com.chef.every15' do
128
+ # action :enables
129
+ # end
130
+ #
131
+ # The Examples section demonstrates the different ways to test a
132
+ # +launchd+ resource with ChefSpec.
133
+ #
134
+ # @example Assert that a +launchd+ was enabled
135
+ # expect(chef_run).to enable_launchd('com.chef.every15')
136
+ #
137
+ # @example Assert that a +launchd+ was _not_ enabled
138
+ # expect(chef_run).to_not enable_launchd('com.chef.every15')
139
+ #
140
+ #
141
+ # @param [String, Regex] resource_name
142
+ # the name of the resource to match
143
+ #
144
+ # @return [ChefSpec::Matchers::ResourceMatcher]
145
+ #
146
+
147
+ def enable_launchd(resource_name)
148
+ ChefSpec::Matchers::ResourceMatcher.new(:launchd, :enable, resource_name)
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,155 @@
1
+ module ChefSpec::API
2
+ # @since 5.1.0
3
+ module OpenbsdPackageMatchers
4
+ ChefSpec.define_matcher :openbsd_package
5
+
6
+ #
7
+ # Assert that an +openbsd_package+ resource exists in the Chef run with the
8
+ # action +:install+. Given a Chef Recipe that installs "apache2" as an
9
+ # +openbsd_package+:
10
+ #
11
+ # openbsd_package 'apache2' do
12
+ # action :install
13
+ # end
14
+ #
15
+ # The Examples section demonstrates the different ways to test an
16
+ # +openbsd_package+ resource with ChefSpec.
17
+ #
18
+ # @example Assert that an +openbsd_package+ was installed
19
+ # expect(chef_run).to install_openbsd_package('apache2')
20
+ #
21
+ # @example Assert that an +openbsd_package+ was installed with predicate matchers
22
+ # expect(chef_run).to install_openbsd_package('apache2').with_version('1.2.3')
23
+ #
24
+ # @example Assert that an +openbsd_package+ was installed with attributes
25
+ # expect(chef_run).to install_openbsd_package('apache2').with(version: '1.2.3')
26
+ #
27
+ # @example Assert that an +openbsd_package+ was installed using a regex
28
+ # expect(chef_run).to install_openbsd_package('apache2').with(version: /(\d+\.){2}\.\d+/)
29
+ #
30
+ # @example Assert that an +openbsd_package+ was _not_ installed
31
+ # expect(chef_run).to_not install_openbsd_package('apache2')
32
+ #
33
+ #
34
+ # @param [String, Regex] resource_name
35
+ # the name of the resource to match
36
+ #
37
+ # @return [ChefSpec::Matchers::ResourceMatcher]
38
+ #
39
+ def install_openbsd_package(resource_name)
40
+ ChefSpec::Matchers::ResourceMatcher.new(:openbsd_package, :install, resource_name)
41
+ end
42
+
43
+ #
44
+ # Assert that an +openbsd_package+ resource exists in the Chef run with the
45
+ # action +:purge+. Given a Chef Recipe that purges "apache2" as an
46
+ # +openbsd_package+:
47
+ #
48
+ # openbsd_package 'apache2' do
49
+ # action :purge
50
+ # end
51
+ #
52
+ # The Examples section demonstrates the different ways to test an
53
+ # +openbsd_package+ resource with ChefSpec.
54
+ #
55
+ # @example Assert that an +openbsd_package+ was purged
56
+ # expect(chef_run).to purge_openbsd_package('apache2')
57
+ #
58
+ # @example Assert that an +openbsd_package+ was purged with predicate matchers
59
+ # expect(chef_run).to purge_openbsd_package('apache2').with_version('1.2.3')
60
+ #
61
+ # @example Assert that an +openbsd_package+ was purged with attributes
62
+ # expect(chef_run).to purge_openbsd_package('apache2').with(version: '1.2.3')
63
+ #
64
+ # @example Assert that an +openbsd_package+ was purged using a regex
65
+ # expect(chef_run).to purge_openbsd_package('apache2').with(version: /(\d+\.){2}\.\d+/)
66
+ #
67
+ # @example Assert that an +openbsd_package+ was _not_ purged
68
+ # expect(chef_run).to_not purge_openbsd_package('apache2')
69
+ #
70
+ #
71
+ # @param [String, Regex] resource_name
72
+ # the name of the resource to match
73
+ #
74
+ # @return [ChefSpec::Matchers::ResourceMatcher]
75
+ #
76
+ def purge_openbsd_package(resource_name)
77
+ ChefSpec::Matchers::ResourceMatcher.new(:openbsd_package, :purge, resource_name)
78
+ end
79
+
80
+ #
81
+ # Assert that an +openbsd_package+ resource exists in the Chef run with the
82
+ # action +:remove+. Given a Chef Recipe that removes "apache2" as an
83
+ # +openbsd_package+:
84
+ #
85
+ # openbsd_package 'apache2' do
86
+ # action :remove
87
+ # end
88
+ #
89
+ # The Examples section demonstrates the different ways to test an
90
+ # +openbsd_package+ resource with ChefSpec.
91
+ #
92
+ # @example Assert that an +openbsd_package+ was removed
93
+ # expect(chef_run).to remove_openbsd_package('apache2')
94
+ #
95
+ # @example Assert that an +openbsd_package+ was removed with predicate matchers
96
+ # expect(chef_run).to remove_openbsd_package('apache2').with_version('1.2.3')
97
+ #
98
+ # @example Assert that an +openbsd_package+ was removed with attributes
99
+ # expect(chef_run).to remove_openbsd_package('apache2').with(version: '1.2.3')
100
+ #
101
+ # @example Assert that an +openbsd_package+ was removed using a regex
102
+ # expect(chef_run).to remove_openbsd_package('apache2').with(version: /(\d+\.){2}\.\d+/)
103
+ #
104
+ # @example Assert that an +openbsd_package+ was _not_ removed
105
+ # expect(chef_run).to_not remove_openbsd_package('apache2')
106
+ #
107
+ #
108
+ # @param [String, Regex] resource_name
109
+ # the name of the resource to match
110
+ #
111
+ # @return [ChefSpec::Matchers::ResourceMatcher]
112
+ #
113
+ def remove_openbsd_package(resource_name)
114
+ ChefSpec::Matchers::ResourceMatcher.new(:openbsd_package, :remove, resource_name)
115
+ end
116
+
117
+ #
118
+ # Assert that an +openbsd_package+ resource exists in the Chef run with the
119
+ # action +:upgrade+. Given a Chef Recipe that upgrades "apache2" as an
120
+ # +openbsd_package+:
121
+ #
122
+ # openbsd_package 'apache2' do
123
+ # action :upgrade
124
+ # end
125
+ #
126
+ # The Examples section demonstrates the different ways to test an
127
+ # +openbsd_package+ resource with ChefSpec.
128
+ #
129
+ # @example Assert that an +openbsd_package+ was upgraded
130
+ # expect(chef_run).to upgrade_openbsd_package('apache2')
131
+ #
132
+ # @example Assert that an +openbsd_package+ was upgraded with predicate matchers
133
+ # expect(chef_run).to upgrade_openbsd_package('apache2').with_version('1.2.3')
134
+ #
135
+ # @example Assert that an +openbsd_package+ was upgraded with attributes
136
+ # expect(chef_run).to upgrade_openbsd_package('apache2').with(version: '1.2.3')
137
+ #
138
+ # @example Assert that an +openbsd_package+ was upgraded using a regex
139
+ # expect(chef_run).to upgrade_openbsd_package('apache2').with(version: /(\d+\.){2}\.\d+/)
140
+ #
141
+ # @example Assert that an +openbsd_package+ was _not_ upgraded
142
+ # expect(chef_run).to_not upgrade_openbsd_package('apache2')
143
+ #
144
+ #
145
+ # @param [String, Regex] resource_name
146
+ # the name of the resource to match
147
+ #
148
+ # @return [ChefSpec::Matchers::ResourceMatcher]
149
+ #
150
+ def upgrade_openbsd_package(resource_name)
151
+ ChefSpec::Matchers::ResourceMatcher.new(:openbsd_package, :upgrade, resource_name)
152
+ end
153
+
154
+ end
155
+ end
@@ -0,0 +1,63 @@
1
+ module ChefSpec::API
2
+ # @since 5.1.0
3
+ module OsxProfileMatchers
4
+ ChefSpec.define_matcher :osx_profile
5
+
6
+ #
7
+ # Assert that an +osx_profile+ resource exists in the Chef run with the
8
+ # action +:install+. Given a Chef Recipe that installs "bsmith" as an
9
+ # +profile+:
10
+ #
11
+ # osx_profile 'bsmith' do
12
+ # action :install
13
+ # end
14
+ #
15
+ # The Examples section demonstrates the different ways to test an
16
+ # +osx_profile+ resource with ChefSpec.
17
+ #
18
+ # @example Assert that an +osx_profile+ was installed
19
+ # expect(chef_run).to install_osx_profile('bsmith')
20
+ #
21
+ # @example Assert that an +osx_profile+ was _not_ installed
22
+ # expect(chef_run).to_not install_osx_profile('bsmith')
23
+ #
24
+ #
25
+ # @param [String, Regex] resource_name
26
+ # the name of the resource to match
27
+ #
28
+ # @return [ChefSpec::Matchers::ResourceMatcher]
29
+ #
30
+ def install_osx_profile(resource_name)
31
+ ChefSpec::Matchers::ResourceMatcher.new(:osx_profile, :install, resource_name)
32
+ end
33
+
34
+ #
35
+ # Assert that an +osx_profile+ resource exists in the Chef run with the
36
+ # action +:remove+. Given a Chef Recipe that removes "bsmith" as an
37
+ # +profile+:
38
+ #
39
+ # osx_profile 'bsmith' do
40
+ # action :remove
41
+ # end
42
+ #
43
+ # The Examples section demonstrates the different ways to test an
44
+ # +osx_profile+ resource with ChefSpec.
45
+ #
46
+ # @example Assert that an +osx_profile+ was removed
47
+ # expect(chef_run).to remove_osx_profile('bsmith')
48
+ #
49
+ # @example Assert that an +osx_profile+ was _not_ removed
50
+ # expect(chef_run).to_not remove_osx_profile('bsmith')
51
+ #
52
+ #
53
+ # @param [String, Regex] resource_name
54
+ # the name of the resource to match
55
+ #
56
+ # @return [ChefSpec::Matchers::ResourceMatcher]
57
+ #
58
+ def remove_osx_profile(resource_name)
59
+ ChefSpec::Matchers::ResourceMatcher.new(:osx_profile, :remove, resource_name)
60
+ end
61
+
62
+ end
63
+ end
@@ -0,0 +1,155 @@
1
+ module ChefSpec::API
2
+ # @since 5.1.0
3
+ module PaludisPackageMatchers
4
+ ChefSpec.define_matcher :paludis_package
5
+
6
+ #
7
+ # Assert that an +paludis_package+ resource exists in the Chef run with the
8
+ # action +:install+. Given a Chef Recipe that installs "apache2" as an
9
+ # +paludis_package+:
10
+ #
11
+ # paludis_package 'apache2' do
12
+ # action :install
13
+ # end
14
+ #
15
+ # The Examples section demonstrates the different ways to test an
16
+ # +paludis_package+ resource with ChefSpec.
17
+ #
18
+ # @example Assert that an +paludis_package+ was installed
19
+ # expect(chef_run).to install_paludis_package('apache2')
20
+ #
21
+ # @example Assert that an +paludis_package+ was installed with predicate matchers
22
+ # expect(chef_run).to install_paludis_package('apache2').with_version('1.2.3')
23
+ #
24
+ # @example Assert that an +paludis_package+ was installed with attributes
25
+ # expect(chef_run).to install_paludis_package('apache2').with(version: '1.2.3')
26
+ #
27
+ # @example Assert that an +paludis_package+ was installed using a regex
28
+ # expect(chef_run).to install_paludis_package('apache2').with(version: /(\d+\.){2}\.\d+/)
29
+ #
30
+ # @example Assert that an +paludis_package+ was _not_ installed
31
+ # expect(chef_run).to_not install_paludis_package('apache2')
32
+ #
33
+ #
34
+ # @param [String, Regex] resource_name
35
+ # the name of the resource to match
36
+ #
37
+ # @return [ChefSpec::Matchers::ResourceMatcher]
38
+ #
39
+ def install_paludis_package(resource_name)
40
+ ChefSpec::Matchers::ResourceMatcher.new(:paludis_package, :install, resource_name)
41
+ end
42
+
43
+ #
44
+ # Assert that an +paludis_package+ resource exists in the Chef run with the
45
+ # action +:purge+. Given a Chef Recipe that purges "apache2" as an
46
+ # +paludis_package+:
47
+ #
48
+ # paludis_package 'apache2' do
49
+ # action :purge
50
+ # end
51
+ #
52
+ # The Examples section demonstrates the different ways to test an
53
+ # +paludis_package+ resource with ChefSpec.
54
+ #
55
+ # @example Assert that an +paludis_package+ was purged
56
+ # expect(chef_run).to purge_paludis_package('apache2')
57
+ #
58
+ # @example Assert that an +paludis_package+ was purged with predicate matchers
59
+ # expect(chef_run).to purge_paludis_package('apache2').with_version('1.2.3')
60
+ #
61
+ # @example Assert that an +paludis_package+ was purged with attributes
62
+ # expect(chef_run).to purge_paludis_package('apache2').with(version: '1.2.3')
63
+ #
64
+ # @example Assert that an +paludis_package+ was purged using a regex
65
+ # expect(chef_run).to purge_paludis_package('apache2').with(version: /(\d+\.){2}\.\d+/)
66
+ #
67
+ # @example Assert that an +paludis_package+ was _not_ purged
68
+ # expect(chef_run).to_not purge_paludis_package('apache2')
69
+ #
70
+ #
71
+ # @param [String, Regex] resource_name
72
+ # the name of the resource to match
73
+ #
74
+ # @return [ChefSpec::Matchers::ResourceMatcher]
75
+ #
76
+ def purge_paludis_package(resource_name)
77
+ ChefSpec::Matchers::ResourceMatcher.new(:paludis_package, :purge, resource_name)
78
+ end
79
+
80
+ #
81
+ # Assert that an +paludis_package+ resource exists in the Chef run with the
82
+ # action +:remove+. Given a Chef Recipe that removes "apache2" as an
83
+ # +paludis_package+:
84
+ #
85
+ # paludis_package 'apache2' do
86
+ # action :remove
87
+ # end
88
+ #
89
+ # The Examples section demonstrates the different ways to test an
90
+ # +paludis_package+ resource with ChefSpec.
91
+ #
92
+ # @example Assert that an +paludis_package+ was removed
93
+ # expect(chef_run).to remove_paludis_package('apache2')
94
+ #
95
+ # @example Assert that an +paludis_package+ was removed with predicate matchers
96
+ # expect(chef_run).to remove_paludis_package('apache2').with_version('1.2.3')
97
+ #
98
+ # @example Assert that an +paludis_package+ was removed with attributes
99
+ # expect(chef_run).to remove_paludis_package('apache2').with(version: '1.2.3')
100
+ #
101
+ # @example Assert that an +paludis_package+ was removed using a regex
102
+ # expect(chef_run).to remove_paludis_package('apache2').with(version: /(\d+\.){2}\.\d+/)
103
+ #
104
+ # @example Assert that an +paludis_package+ was _not_ removed
105
+ # expect(chef_run).to_not remove_paludis_package('apache2')
106
+ #
107
+ #
108
+ # @param [String, Regex] resource_name
109
+ # the name of the resource to match
110
+ #
111
+ # @return [ChefSpec::Matchers::ResourceMatcher]
112
+ #
113
+ def remove_paludis_package(resource_name)
114
+ ChefSpec::Matchers::ResourceMatcher.new(:paludis_package, :remove, resource_name)
115
+ end
116
+
117
+ #
118
+ # Assert that an +paludis_package+ resource exists in the Chef run with the
119
+ # action +:upgrade+. Given a Chef Recipe that upgrades "apache2" as an
120
+ # +paludis_package+:
121
+ #
122
+ # paludis_package 'apache2' do
123
+ # action :upgrade
124
+ # end
125
+ #
126
+ # The Examples section demonstrates the different ways to test an
127
+ # +paludis_package+ resource with ChefSpec.
128
+ #
129
+ # @example Assert that an +paludis_package+ was upgraded
130
+ # expect(chef_run).to upgrade_paludis_package('apache2')
131
+ #
132
+ # @example Assert that an +paludis_package+ was upgraded with predicate matchers
133
+ # expect(chef_run).to upgrade_paludis_package('apache2').with_version('1.2.3')
134
+ #
135
+ # @example Assert that an +paludis_package+ was upgraded with attributes
136
+ # expect(chef_run).to upgrade_paludis_package('apache2').with(version: '1.2.3')
137
+ #
138
+ # @example Assert that an +paludis_package+ was upgraded using a regex
139
+ # expect(chef_run).to upgrade_paludis_package('apache2').with(version: /(\d+\.){2}\.\d+/)
140
+ #
141
+ # @example Assert that an +paludis_package+ was _not_ upgraded
142
+ # expect(chef_run).to_not upgrade_paludis_package('apache2')
143
+ #
144
+ #
145
+ # @param [String, Regex] resource_name
146
+ # the name of the resource to match
147
+ #
148
+ # @return [ChefSpec::Matchers::ResourceMatcher]
149
+ #
150
+ def upgrade_paludis_package(resource_name)
151
+ ChefSpec::Matchers::ResourceMatcher.new(:paludis_package, :upgrade, resource_name)
152
+ end
153
+
154
+ end
155
+ end