chefspec 2.0.1 → 3.0.0.beta.1
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.
- checksums.yaml +4 -4
- data/lib/chefspec.rb +30 -44
- data/lib/chefspec/api.rb +74 -0
- data/lib/chefspec/api/apt_package.rb +192 -0
- data/lib/chefspec/api/batch.rb +43 -0
- data/lib/chefspec/api/chef_gem.rb +191 -0
- data/lib/chefspec/api/cookbook_file.rb +166 -0
- data/lib/chefspec/api/cron.rb +80 -0
- data/lib/chefspec/api/deploy.rb +117 -0
- data/lib/chefspec/api/directory.rb +80 -0
- data/lib/chefspec/api/dpkg_package.rb +117 -0
- data/lib/chefspec/api/easy_install_package.rb +154 -0
- data/lib/chefspec/api/env.rb +117 -0
- data/lib/chefspec/api/erl_call.rb +43 -0
- data/lib/chefspec/api/execute.rb +43 -0
- data/lib/chefspec/api/file.rb +166 -0
- data/lib/chefspec/api/freebsd_package.rb +80 -0
- data/lib/chefspec/api/gem_package.rb +191 -0
- data/lib/chefspec/api/git.rb +117 -0
- data/lib/chefspec/api/group.rb +154 -0
- data/lib/chefspec/api/http_request.rb +228 -0
- data/lib/chefspec/api/ifconfig.rb +154 -0
- data/lib/chefspec/api/include_recipe.rb +26 -0
- data/lib/chefspec/api/ips_package.rb +117 -0
- data/lib/chefspec/api/link.rb +102 -0
- data/lib/chefspec/api/log.rb +43 -0
- data/lib/chefspec/api/macports_package.rb +154 -0
- data/lib/chefspec/api/mdadm.rb +117 -0
- data/lib/chefspec/api/mount.rb +192 -0
- data/lib/chefspec/api/notifications.rb +38 -0
- data/lib/chefspec/api/ohai.rb +43 -0
- data/lib/chefspec/api/package.rb +192 -0
- data/lib/chefspec/api/pacman_package.rb +155 -0
- data/lib/chefspec/api/portage_package.rb +155 -0
- data/lib/chefspec/api/powershell_script.rb +43 -0
- data/lib/chefspec/api/registry_key.rb +166 -0
- data/lib/chefspec/api/remote_directory.rb +120 -0
- data/lib/chefspec/api/remote_file.rb +166 -0
- data/lib/chefspec/api/render_file.rb +32 -0
- data/lib/chefspec/api/route.rb +80 -0
- data/lib/chefspec/api/rpm_package.rb +117 -0
- data/lib/chefspec/api/ruby_block.rb +37 -0
- data/lib/chefspec/api/script.rb +228 -0
- data/lib/chefspec/api/service.rb +246 -0
- data/lib/chefspec/api/smartos_package.rb +117 -0
- data/lib/chefspec/api/solaris_package.rb +80 -0
- data/lib/chefspec/api/subversion.rb +154 -0
- data/lib/chefspec/api/template.rb +166 -0
- data/lib/chefspec/api/user.rb +228 -0
- data/lib/chefspec/api/yum_package.rb +154 -0
- data/lib/chefspec/berkshelf.rb +37 -0
- data/lib/chefspec/deprecations.rb +151 -0
- data/lib/chefspec/errors.rb +99 -0
- data/lib/chefspec/expect_exception.rb +45 -0
- data/lib/chefspec/extensions/chef/client.rb +15 -0
- data/lib/chefspec/extensions/chef/conditional.rb +11 -0
- data/lib/chefspec/extensions/chef/data_query.rb +29 -0
- data/lib/chefspec/extensions/chef/lwrp_base.rb +44 -0
- data/lib/chefspec/extensions/chef/resource.rb +27 -0
- data/lib/chefspec/extensions/chef/securable.rb +19 -0
- data/lib/chefspec/formatter.rb +270 -0
- data/lib/chefspec/macros.rb +217 -0
- data/lib/chefspec/matchers.rb +9 -0
- data/lib/chefspec/matchers/include_recipe_matcher.rb +45 -0
- data/lib/chefspec/matchers/link_to_matcher.rb +28 -0
- data/lib/chefspec/matchers/notifications_matcher.rb +92 -0
- data/lib/chefspec/matchers/render_file_matcher.rb +72 -0
- data/lib/chefspec/matchers/resource_matcher.rb +143 -0
- data/lib/chefspec/renderer.rb +137 -0
- data/lib/chefspec/rspec.rb +17 -0
- data/lib/chefspec/runner.rb +274 -0
- data/lib/chefspec/stubs/command_registry.rb +11 -0
- data/lib/chefspec/stubs/command_stub.rb +37 -0
- data/lib/chefspec/stubs/data_bag_item_registry.rb +13 -0
- data/lib/chefspec/stubs/data_bag_item_stub.rb +25 -0
- data/lib/chefspec/stubs/data_bag_registry.rb +13 -0
- data/lib/chefspec/stubs/data_bag_stub.rb +23 -0
- data/lib/chefspec/stubs/registry.rb +32 -0
- data/lib/chefspec/stubs/search_registry.rb +13 -0
- data/lib/chefspec/stubs/search_stub.rb +25 -0
- data/lib/chefspec/stubs/stub.rb +37 -0
- data/lib/chefspec/version.rb +1 -2
- metadata +100 -103
- data/lib/chef/expect_exception.rb +0 -34
- data/lib/chef/formatters/chefspec.rb +0 -233
- data/lib/chef/knife/cookbook_create_specs.rb +0 -107
- data/lib/chefspec/chef_runner.rb +0 -275
- data/lib/chefspec/helpers/describe.rb +0 -17
- data/lib/chefspec/matchers/cron.rb +0 -7
- data/lib/chefspec/matchers/env.rb +0 -8
- data/lib/chefspec/matchers/execute.rb +0 -33
- data/lib/chefspec/matchers/file.rb +0 -83
- data/lib/chefspec/matchers/file_content.rb +0 -32
- data/lib/chefspec/matchers/group.rb +0 -8
- data/lib/chefspec/matchers/include_recipe.rb +0 -20
- data/lib/chefspec/matchers/link.rb +0 -14
- data/lib/chefspec/matchers/log.rb +0 -21
- data/lib/chefspec/matchers/notifications.rb +0 -43
- data/lib/chefspec/matchers/package.rb +0 -39
- data/lib/chefspec/matchers/python.rb +0 -7
- data/lib/chefspec/matchers/ruby_block.rb +0 -13
- data/lib/chefspec/matchers/script.rb +0 -34
- data/lib/chefspec/matchers/service.rb +0 -25
- data/lib/chefspec/matchers/shared.rb +0 -132
- data/lib/chefspec/matchers/user.rb +0 -8
- data/lib/chefspec/minitest.rb +0 -195
- data/lib/chefspec/monkey_patches/conditional.rb +0 -19
- data/lib/chefspec/monkey_patches/hash.rb +0 -23
- data/lib/chefspec/monkey_patches/lwrp_base.rb +0 -45
- data/lib/chefspec/monkey_patches/provider.rb +0 -43
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
module ChefSpec::API
|
|
2
|
+
# @since 0.0.1
|
|
3
|
+
module ServiceMatchers
|
|
4
|
+
ChefSpec::Runner.define_runner_method :service
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
# Assert that a +service+ resource exists in the Chef run with the
|
|
8
|
+
# action +:disable+. Given a Chef Recipe that disables "apache2" as a
|
|
9
|
+
# +service+:
|
|
10
|
+
#
|
|
11
|
+
# service 'apache2' do
|
|
12
|
+
# action :disable
|
|
13
|
+
# end
|
|
14
|
+
#
|
|
15
|
+
# To test the content rendered by a +service+, see
|
|
16
|
+
# {ChefSpec::API::RenderFileMatchers}.
|
|
17
|
+
#
|
|
18
|
+
# The Examples section demonstrates the different ways to test a
|
|
19
|
+
# +service+ resource with ChefSpec.
|
|
20
|
+
#
|
|
21
|
+
# @example Assert that a +service+ was disabled
|
|
22
|
+
# expect(chef_run).to disable_service('apache2')
|
|
23
|
+
#
|
|
24
|
+
# @example Assert that a +service+ was disabled with predicate matchers
|
|
25
|
+
# expect(chef_run).to disable_service('apache2').with_pattern('apa*')
|
|
26
|
+
#
|
|
27
|
+
# @example Assert that a +service+ was disabled with attributes
|
|
28
|
+
# expect(chef_run).to disable_service('apache2').with(pattern: 'apa*')
|
|
29
|
+
#
|
|
30
|
+
# @example Assert that a +service+ was disabled using a regex
|
|
31
|
+
# expect(chef_run).to disable_service('apache2').with(patthen: /(.+)/)
|
|
32
|
+
#
|
|
33
|
+
# @example Assert that a +service+ was _not_ disabled
|
|
34
|
+
# expect(chef_run).to_not disable_service('apache2')
|
|
35
|
+
#
|
|
36
|
+
#
|
|
37
|
+
# @param [String, Regex] resource_name
|
|
38
|
+
# the name of the resource to match
|
|
39
|
+
#
|
|
40
|
+
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
41
|
+
#
|
|
42
|
+
def disable_service(resource_name)
|
|
43
|
+
ChefSpec::Matchers::ResourceMatcher.new(:service, :disable, resource_name)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
#
|
|
47
|
+
# Assert that a +service+ resource exists in the Chef run with the
|
|
48
|
+
# action +:enable+. Given a Chef Recipe that enables "apache2" as a
|
|
49
|
+
# +service+:
|
|
50
|
+
#
|
|
51
|
+
# service 'apache2' do
|
|
52
|
+
# action :enable
|
|
53
|
+
# end
|
|
54
|
+
#
|
|
55
|
+
# To test the content rendered by a +service+, see
|
|
56
|
+
# {ChefSpec::API::RenderFileMatchers}.
|
|
57
|
+
#
|
|
58
|
+
# The Examples section demonstrates the different ways to test a
|
|
59
|
+
# +service+ resource with ChefSpec.
|
|
60
|
+
#
|
|
61
|
+
# @example Assert that a +service+ was enabled
|
|
62
|
+
# expect(chef_run).to enable_service('apache2')
|
|
63
|
+
#
|
|
64
|
+
# @example Assert that a +service+ was enabled with predicate matchers
|
|
65
|
+
# expect(chef_run).to enable_service('apache2').with_pattern('apa*')
|
|
66
|
+
#
|
|
67
|
+
# @example Assert that a +service+ was enabled with attributes
|
|
68
|
+
# expect(chef_run).to enable_service('apache2').with(pattern: 'apa*')
|
|
69
|
+
#
|
|
70
|
+
# @example Assert that a +service+ was enabled using a regex
|
|
71
|
+
# expect(chef_run).to enable_service('apache2').with(patthen: /(.+)/)
|
|
72
|
+
#
|
|
73
|
+
# @example Assert that a +service+ was _not_ enabled
|
|
74
|
+
# expect(chef_run).to_not enable_service('apache2')
|
|
75
|
+
#
|
|
76
|
+
#
|
|
77
|
+
# @param [String, Regex] resource_name
|
|
78
|
+
# the name of the resource to match
|
|
79
|
+
#
|
|
80
|
+
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
81
|
+
#
|
|
82
|
+
def enable_service(resource_name)
|
|
83
|
+
ChefSpec::Matchers::ResourceMatcher.new(:service, :enable, resource_name)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
#
|
|
87
|
+
# Assert that a +service+ resource exists in the Chef run with the
|
|
88
|
+
# action +:reload+. Given a Chef Recipe that reloads "apache2" as a
|
|
89
|
+
# +service+:
|
|
90
|
+
#
|
|
91
|
+
# service 'apache2' do
|
|
92
|
+
# action :reload
|
|
93
|
+
# end
|
|
94
|
+
#
|
|
95
|
+
# To test the content rendered by a +service+, see
|
|
96
|
+
# {ChefSpec::API::RenderFileMatchers}.
|
|
97
|
+
#
|
|
98
|
+
# The Examples section demonstrates the different ways to test a
|
|
99
|
+
# +service+ resource with ChefSpec.
|
|
100
|
+
#
|
|
101
|
+
# @example Assert that a +service+ was reload
|
|
102
|
+
# expect(chef_run).to reload_service('apache2')
|
|
103
|
+
#
|
|
104
|
+
# @example Assert that a +service+ was reload with predicate matchers
|
|
105
|
+
# expect(chef_run).to reload_service('apache2').with_pattern('apa*')
|
|
106
|
+
#
|
|
107
|
+
# @example Assert that a +service+ was reload with attributes
|
|
108
|
+
# expect(chef_run).to reload_service('apache2').with(pattern: 'apa*')
|
|
109
|
+
#
|
|
110
|
+
# @example Assert that a +service+ was reload using a regex
|
|
111
|
+
# expect(chef_run).to reload_service('apache2').with(patthen: /(.+)/)
|
|
112
|
+
#
|
|
113
|
+
# @example Assert that a +service+ was _not_ reload
|
|
114
|
+
# expect(chef_run).to_not reload_service('apache2')
|
|
115
|
+
#
|
|
116
|
+
#
|
|
117
|
+
# @param [String, Regex] resource_name
|
|
118
|
+
# the name of the resource to match
|
|
119
|
+
#
|
|
120
|
+
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
121
|
+
#
|
|
122
|
+
def reload_service(resource_name)
|
|
123
|
+
ChefSpec::Matchers::ResourceMatcher.new(:service, :reload, resource_name)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
#
|
|
127
|
+
# Assert that a +service+ resource exists in the Chef run with the
|
|
128
|
+
# action +:restart+. Given a Chef Recipe that restarts "apache2" as a
|
|
129
|
+
# +service+:
|
|
130
|
+
#
|
|
131
|
+
# service 'apache2' do
|
|
132
|
+
# action :restart
|
|
133
|
+
# end
|
|
134
|
+
#
|
|
135
|
+
# To test the content rendered by a +service+, see
|
|
136
|
+
# {ChefSpec::API::RenderFileMatchers}.
|
|
137
|
+
#
|
|
138
|
+
# The Examples section demonstrates the different ways to test a
|
|
139
|
+
# +service+ resource with ChefSpec.
|
|
140
|
+
#
|
|
141
|
+
# @example Assert that a +service+ was restarted
|
|
142
|
+
# expect(chef_run).to restart_service('apache2')
|
|
143
|
+
#
|
|
144
|
+
# @example Assert that a +service+ was restarted with predicate matchers
|
|
145
|
+
# expect(chef_run).to restart_service('apache2').with_pattern('apa*')
|
|
146
|
+
#
|
|
147
|
+
# @example Assert that a +service+ was restarted with attributes
|
|
148
|
+
# expect(chef_run).to restart_service('apache2').with(pattern: 'apa*')
|
|
149
|
+
#
|
|
150
|
+
# @example Assert that a +service+ was restarted using a regex
|
|
151
|
+
# expect(chef_run).to restart_service('apache2').with(patthen: /(.+)/)
|
|
152
|
+
#
|
|
153
|
+
# @example Assert that a +service+ was _not_ restarted
|
|
154
|
+
# expect(chef_run).to_not restart_service('apache2')
|
|
155
|
+
#
|
|
156
|
+
#
|
|
157
|
+
# @param [String, Regex] resource_name
|
|
158
|
+
# the name of the resource to match
|
|
159
|
+
#
|
|
160
|
+
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
161
|
+
#
|
|
162
|
+
def restart_service(resource_name)
|
|
163
|
+
ChefSpec::Matchers::ResourceMatcher.new(:service, :restart, resource_name)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
#
|
|
167
|
+
# Assert that a +service+ resource exists in the Chef run with the
|
|
168
|
+
# action +:start+. Given a Chef Recipe that starts "apache2" as a
|
|
169
|
+
# +service+:
|
|
170
|
+
#
|
|
171
|
+
# service 'apache2' do
|
|
172
|
+
# action :start
|
|
173
|
+
# end
|
|
174
|
+
#
|
|
175
|
+
# To test the content rendered by a +service+, see
|
|
176
|
+
# {ChefSpec::API::RenderFileMatchers}.
|
|
177
|
+
#
|
|
178
|
+
# The Examples section demonstrates the different ways to test a
|
|
179
|
+
# +service+ resource with ChefSpec.
|
|
180
|
+
#
|
|
181
|
+
# @example Assert that a +service+ was started
|
|
182
|
+
# expect(chef_run).to start_service('apache2')
|
|
183
|
+
#
|
|
184
|
+
# @example Assert that a +service+ was started with predicate matchers
|
|
185
|
+
# expect(chef_run).to start_service('apache2').with_pattern('apa*')
|
|
186
|
+
#
|
|
187
|
+
# @example Assert that a +service+ was started with attributes
|
|
188
|
+
# expect(chef_run).to start_service('apache2').with(pattern: 'apa*')
|
|
189
|
+
#
|
|
190
|
+
# @example Assert that a +service+ was started using a regex
|
|
191
|
+
# expect(chef_run).to start_service('apache2').with(patthen: /(.+)/)
|
|
192
|
+
#
|
|
193
|
+
# @example Assert that a +service+ was _not_ started
|
|
194
|
+
# expect(chef_run).to_not start_service('apache2')
|
|
195
|
+
#
|
|
196
|
+
#
|
|
197
|
+
# @param [String, Regex] resource_name
|
|
198
|
+
# the name of the resource to match
|
|
199
|
+
#
|
|
200
|
+
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
201
|
+
#
|
|
202
|
+
def start_service(resource_name)
|
|
203
|
+
ChefSpec::Matchers::ResourceMatcher.new(:service, :start, resource_name)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
#
|
|
207
|
+
# Assert that a +service+ resource exists in the Chef run with the
|
|
208
|
+
# action +:stop+. Given a Chef Recipe that stops "apache2" as a
|
|
209
|
+
# +service+:
|
|
210
|
+
#
|
|
211
|
+
# service 'apache2' do
|
|
212
|
+
# action :stop
|
|
213
|
+
# end
|
|
214
|
+
#
|
|
215
|
+
# To test the content rendered by a +service+, see
|
|
216
|
+
# {ChefSpec::API::RenderFileMatchers}.
|
|
217
|
+
#
|
|
218
|
+
# The Examples section demonstrates the different ways to test a
|
|
219
|
+
# +service+ resource with ChefSpec.
|
|
220
|
+
#
|
|
221
|
+
# @example Assert that a +service+ was stopped
|
|
222
|
+
# expect(chef_run).to stop_service('apache2')
|
|
223
|
+
#
|
|
224
|
+
# @example Assert that a +service+ was stopped with predicate matchers
|
|
225
|
+
# expect(chef_run).to stop_service('apache2').with_pattern('apa*')
|
|
226
|
+
#
|
|
227
|
+
# @example Assert that a +service+ was stopped with attributes
|
|
228
|
+
# expect(chef_run).to stop_service('apache2').with(pattern: 'apa*')
|
|
229
|
+
#
|
|
230
|
+
# @example Assert that a +service+ was stopped using a regex
|
|
231
|
+
# expect(chef_run).to stop_service('apache2').with(patthen: /(.+)/)
|
|
232
|
+
#
|
|
233
|
+
# @example Assert that a +service+ was _not_ stopped
|
|
234
|
+
# expect(chef_run).to_not stop_service('apache2')
|
|
235
|
+
#
|
|
236
|
+
#
|
|
237
|
+
# @param [String, Regex] resource_name
|
|
238
|
+
# the name of the resource to match
|
|
239
|
+
#
|
|
240
|
+
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
241
|
+
#
|
|
242
|
+
def stop_service(resource_name)
|
|
243
|
+
ChefSpec::Matchers::ResourceMatcher.new(:service, :stop, resource_name)
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
module ChefSpec::API
|
|
2
|
+
# @since 3.0.0
|
|
3
|
+
module SmartosPackageMatchers
|
|
4
|
+
ChefSpec::Runner.define_runner_method :smartos_package
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
# Assert that a +smartos_package+ resource exists in the Chef run with the
|
|
8
|
+
# action +:install+. Given a Chef Recipe that installs "apache2" as a
|
|
9
|
+
# +smartos_package+:
|
|
10
|
+
#
|
|
11
|
+
# smartos_package 'apache2' do
|
|
12
|
+
# action :install
|
|
13
|
+
# end
|
|
14
|
+
#
|
|
15
|
+
# The Examples section demonstrates the different ways to test a
|
|
16
|
+
# +smartos_package+ resource with ChefSpec.
|
|
17
|
+
#
|
|
18
|
+
# @example Assert that a +smartos_package+ was installed
|
|
19
|
+
# expect(chef_run).to install_smartos_package('apache2')
|
|
20
|
+
#
|
|
21
|
+
# @example Assert that a +smartos_package+ was installed with predicate matchers
|
|
22
|
+
# expect(chef_run).to install_smartos_package('apache2').with_version('1.2.3')
|
|
23
|
+
#
|
|
24
|
+
# @example Assert that a +smartos_package+ was installed with attributes
|
|
25
|
+
# expect(chef_run).to install_smartos_package('apache2').with(version: '1.2.3')
|
|
26
|
+
#
|
|
27
|
+
# @example Assert that a +smartos_package+ was installed using a regex
|
|
28
|
+
# expect(chef_run).to install_smartos_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
29
|
+
#
|
|
30
|
+
# @example Assert that a +smartos_package+ was _not_ installed
|
|
31
|
+
# expect(chef_run).to_not install_smartos_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_smartos_package(resource_name)
|
|
40
|
+
ChefSpec::Matchers::ResourceMatcher.new(:smartos_package, :install, resource_name)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
#
|
|
44
|
+
# Assert that a +smartos_package+ resource exists in the Chef run with the
|
|
45
|
+
# action +:remove+. Given a Chef Recipe that removes "apache2" as a
|
|
46
|
+
# +smartos_package+:
|
|
47
|
+
#
|
|
48
|
+
# smartos_package 'apache2' do
|
|
49
|
+
# action :remove
|
|
50
|
+
# end
|
|
51
|
+
#
|
|
52
|
+
# The Examples section demonstrates the different ways to test a
|
|
53
|
+
# +smartos_package+ resource with ChefSpec.
|
|
54
|
+
#
|
|
55
|
+
# @example Assert that a +smartos_package+ was removed
|
|
56
|
+
# expect(chef_run).to remove_smartos_package('apache2')
|
|
57
|
+
#
|
|
58
|
+
# @example Assert that a +smartos_package+ was removed with predicate matchers
|
|
59
|
+
# expect(chef_run).to remove_smartos_package('apache2').with_version('1.2.3')
|
|
60
|
+
#
|
|
61
|
+
# @example Assert that a +smartos_package+ was removed with attributes
|
|
62
|
+
# expect(chef_run).to remove_smartos_package('apache2').with(version: '1.2.3')
|
|
63
|
+
#
|
|
64
|
+
# @example Assert that a +smartos_package+ was removed using a regex
|
|
65
|
+
# expect(chef_run).to remove_smartos_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
66
|
+
#
|
|
67
|
+
# @example Assert that a +smartos_package+ was _not_ removed
|
|
68
|
+
# expect(chef_run).to_not remove_smartos_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 remove_smartos_package(resource_name)
|
|
77
|
+
ChefSpec::Matchers::ResourceMatcher.new(:smartos_package, :remove, resource_name)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
#
|
|
81
|
+
# Assert that a +smartos_package+ resource exists in the Chef run with the
|
|
82
|
+
# action +:upgrade+. Given a Chef Recipe that upgrades "apache2" as a
|
|
83
|
+
# +smartos_package+:
|
|
84
|
+
#
|
|
85
|
+
# smartos_package 'apache2' do
|
|
86
|
+
# action :upgrade
|
|
87
|
+
# end
|
|
88
|
+
#
|
|
89
|
+
# The Examples section demonstrates the different ways to test a
|
|
90
|
+
# +smartos_package+ resource with ChefSpec.
|
|
91
|
+
#
|
|
92
|
+
# @example Assert that a +smartos_package+ was upgraded
|
|
93
|
+
# expect(chef_run).to upgrade_smartos_package('apache2')
|
|
94
|
+
#
|
|
95
|
+
# @example Assert that a +smartos_package+ was upgraded with predicate matchers
|
|
96
|
+
# expect(chef_run).to upgrade_smartos_package('apache2').with_version('1.2.3')
|
|
97
|
+
#
|
|
98
|
+
# @example Assert that a +smartos_package+ was upgraded with attributes
|
|
99
|
+
# expect(chef_run).to upgrade_smartos_package('apache2').with(version: '1.2.3')
|
|
100
|
+
#
|
|
101
|
+
# @example Assert that a +smartos_package+ was upgraded using a regex
|
|
102
|
+
# expect(chef_run).to upgrade_smartos_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
103
|
+
#
|
|
104
|
+
# @example Assert that a +smartos_package+ was _not_ upgraded
|
|
105
|
+
# expect(chef_run).to_not upgrade_smartos_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 upgrade_smartos_package(resource_name)
|
|
114
|
+
ChefSpec::Matchers::ResourceMatcher.new(:smartos_package, :upgrade, resource_name)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
module ChefSpec::API
|
|
2
|
+
# @since 3.0.0
|
|
3
|
+
module SolarisPackageMatchers
|
|
4
|
+
ChefSpec::Runner.define_runner_method :solaris_package
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
# Assert that a +solaris_package+ resource exists in the Chef run with the
|
|
8
|
+
# action +:install+. Given a Chef Recipe that installs "apache2" as a
|
|
9
|
+
# +solaris_package+:
|
|
10
|
+
#
|
|
11
|
+
# solaris_package 'apache2' do
|
|
12
|
+
# action :install
|
|
13
|
+
# end
|
|
14
|
+
#
|
|
15
|
+
# The Examples section demonstrates the different ways to test a
|
|
16
|
+
# +solaris_package+ resource with ChefSpec.
|
|
17
|
+
#
|
|
18
|
+
# @example Assert that a +solaris_package+ was installed
|
|
19
|
+
# expect(chef_run).to install_solaris_package('apache2')
|
|
20
|
+
#
|
|
21
|
+
# @example Assert that a +solaris_package+ was installed with predicate matchers
|
|
22
|
+
# expect(chef_run).to install_solaris_package('apache2').with_version('1.2.3')
|
|
23
|
+
#
|
|
24
|
+
# @example Assert that a +solaris_package+ was installed with attributes
|
|
25
|
+
# expect(chef_run).to install_solaris_package('apache2').with(version: '1.2.3')
|
|
26
|
+
#
|
|
27
|
+
# @example Assert that a +solaris_package+ was installed using a regex
|
|
28
|
+
# expect(chef_run).to install_solaris_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
29
|
+
#
|
|
30
|
+
# @example Assert that a +solaris_package+ was _not_ installed
|
|
31
|
+
# expect(chef_run).to_not install_solaris_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_solaris_package(resource_name)
|
|
40
|
+
ChefSpec::Matchers::ResourceMatcher.new(:solaris_package, :install, resource_name)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
#
|
|
44
|
+
# Assert that a +solaris_package+ resource exists in the Chef run with the
|
|
45
|
+
# action +:remove+. Given a Chef Recipe that removes "apache2" as a
|
|
46
|
+
# +solaris_package+:
|
|
47
|
+
#
|
|
48
|
+
# solaris_package 'apache2' do
|
|
49
|
+
# action :remove
|
|
50
|
+
# end
|
|
51
|
+
#
|
|
52
|
+
# The Examples section demonstrates the different ways to test a
|
|
53
|
+
# +solaris_package+ resource with ChefSpec.
|
|
54
|
+
#
|
|
55
|
+
# @example Assert that a +solaris_package+ was removed
|
|
56
|
+
# expect(chef_run).to remove_solaris_package('apache2')
|
|
57
|
+
#
|
|
58
|
+
# @example Assert that a +solaris_package+ was removed with predicate matchers
|
|
59
|
+
# expect(chef_run).to remove_solaris_package('apache2').with_version('1.2.3')
|
|
60
|
+
#
|
|
61
|
+
# @example Assert that a +solaris_package+ was removed with attributes
|
|
62
|
+
# expect(chef_run).to remove_solaris_package('apache2').with(version: '1.2.3')
|
|
63
|
+
#
|
|
64
|
+
# @example Assert that a +solaris_package+ was removed using a regex
|
|
65
|
+
# expect(chef_run).to remove_solaris_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
66
|
+
#
|
|
67
|
+
# @example Assert that a +solaris_package+ was _not_ removed
|
|
68
|
+
# expect(chef_run).to_not remove_solaris_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 remove_solaris_package(resource_name)
|
|
77
|
+
ChefSpec::Matchers::ResourceMatcher.new(:solaris_package, :remove, resource_name)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
module ChefSpec::API
|
|
2
|
+
# @since 3.0.0
|
|
3
|
+
module SubversionMatchers
|
|
4
|
+
ChefSpec::Runner.define_runner_method :subversion
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
# Assert that a +subversion+ resource exists in the Chef run with the
|
|
8
|
+
# action +:checkout+. Given a Chef Recipe that checks out "svn://..." as a
|
|
9
|
+
# +subversion+:
|
|
10
|
+
#
|
|
11
|
+
# subversion 'svn://...' do
|
|
12
|
+
# action :checkout
|
|
13
|
+
# end
|
|
14
|
+
#
|
|
15
|
+
# The Examples section demonstrates the different ways to test a
|
|
16
|
+
# +subversion+ resource with ChefSpec.
|
|
17
|
+
#
|
|
18
|
+
# @example Assert that a +subversion+ was checked out
|
|
19
|
+
# expect(chef_run).to checkout_subversion('svn://...')
|
|
20
|
+
#
|
|
21
|
+
# @example Assert that a +subversion+ was checked out with predicate matchers
|
|
22
|
+
# expect(chef_run).to checkout_subversion('svn://...').with_user('svargo')
|
|
23
|
+
#
|
|
24
|
+
# @example Assert that a +subversion+ was checked out with attributes
|
|
25
|
+
# expect(chef_run).to checkout_subversion('svn://...').with(user: 'svargo')
|
|
26
|
+
#
|
|
27
|
+
# @example Assert that a +subversion+ was checked out using a regex
|
|
28
|
+
# expect(chef_run).to checkout_subversion('svn://...').with(user: /sva(.+)/)
|
|
29
|
+
#
|
|
30
|
+
# @example Assert that a +subversion+ was _not_ checked out
|
|
31
|
+
# expect(chef_run).to_not checkout_subversion('svn://...')
|
|
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 checkout_subversion(resource_name)
|
|
40
|
+
ChefSpec::Matchers::ResourceMatcher.new(:subversion, :checkout, resource_name)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
#
|
|
44
|
+
# Assert that a +subversion+ resource exists in the Chef run with the
|
|
45
|
+
# action +:export+. Given a Chef Recipe that exports "svn://" as a
|
|
46
|
+
# +subversion+:
|
|
47
|
+
#
|
|
48
|
+
# subversion 'svn://' do
|
|
49
|
+
# action :export
|
|
50
|
+
# end
|
|
51
|
+
#
|
|
52
|
+
# The Examples section demonstrates the different ways to test a
|
|
53
|
+
# +subversion+ resource with ChefSpec.
|
|
54
|
+
#
|
|
55
|
+
# @example Assert that a +subversion+ was exported
|
|
56
|
+
# expect(chef_run).to export_subversion('svn://')
|
|
57
|
+
#
|
|
58
|
+
# @example Assert that a +subversion+ was exported with predicate matchers
|
|
59
|
+
# expect(chef_run).to export_subversion('svn://').with_user('svargo')
|
|
60
|
+
#
|
|
61
|
+
# @example Assert that a +subversion+ was exported with attributes
|
|
62
|
+
# expect(chef_run).to export_subversion('svn://').with(user: 'svargo')
|
|
63
|
+
#
|
|
64
|
+
# @example Assert that a +subversion+ was exported using a regex
|
|
65
|
+
# expect(chef_run).to export_subversion('svn://').with(user: /sva(.+)/)
|
|
66
|
+
#
|
|
67
|
+
# @example Assert that a +subversion+ was _not_ exported
|
|
68
|
+
# expect(chef_run).to_not export_subversion('svn://')
|
|
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 export_subversion(resource_name)
|
|
77
|
+
ChefSpec::Matchers::ResourceMatcher.new(:subversion, :export, resource_name)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
#
|
|
81
|
+
# Assert that a +subversion+ resource exists in the Chef run with the
|
|
82
|
+
# action +:force_export+. Given a Chef Recipe that force_exports "svn://" as a
|
|
83
|
+
# +subversion+:
|
|
84
|
+
#
|
|
85
|
+
# subversion 'svn://' do
|
|
86
|
+
# action :force_export
|
|
87
|
+
# end
|
|
88
|
+
#
|
|
89
|
+
# The Examples section demonstrates the different ways to test a
|
|
90
|
+
# +subversion+ resource with ChefSpec.
|
|
91
|
+
#
|
|
92
|
+
# @example Assert that a +subversion+ was force_exported
|
|
93
|
+
# expect(chef_run).to force_export_subversion('svn://')
|
|
94
|
+
#
|
|
95
|
+
# @example Assert that a +subversion+ was force_exported with predicate matchers
|
|
96
|
+
# expect(chef_run).to force_export_subversion('svn://').with_user('svargo')
|
|
97
|
+
#
|
|
98
|
+
# @example Assert that a +subversion+ was force_exported with attributes
|
|
99
|
+
# expect(chef_run).to force_export_subversion('svn://').with(user: 'svargo')
|
|
100
|
+
#
|
|
101
|
+
# @example Assert that a +subversion+ was force_exported using a regex
|
|
102
|
+
# expect(chef_run).to force_export_subversion('svn://').with(user: /sva(.+)/)
|
|
103
|
+
#
|
|
104
|
+
# @example Assert that a +subversion+ was _not_ force_exported
|
|
105
|
+
# expect(chef_run).to_not force_export_subversion('svn://')
|
|
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 force_export_subversion(resource_name)
|
|
114
|
+
ChefSpec::Matchers::ResourceMatcher.new(:subversion, :force_export, resource_name)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
#
|
|
118
|
+
# Assert that a +subversion+ resource exists in the Chef run with the
|
|
119
|
+
# action +:sync+. Given a Chef Recipe that syncs "svn://" as a
|
|
120
|
+
# +subversion+:
|
|
121
|
+
#
|
|
122
|
+
# subversion 'svn://' do
|
|
123
|
+
# action :sync
|
|
124
|
+
# end
|
|
125
|
+
#
|
|
126
|
+
# The Examples section demonstrates the different ways to test a
|
|
127
|
+
# +subversion+ resource with ChefSpec.
|
|
128
|
+
#
|
|
129
|
+
# @example Assert that a +subversion+ was synced
|
|
130
|
+
# expect(chef_run).to sync_subversion('svn://')
|
|
131
|
+
#
|
|
132
|
+
# @example Assert that a +subversion+ was synced with predicate matchers
|
|
133
|
+
# expect(chef_run).to sync_subversion('svn://').with_user('svargo')
|
|
134
|
+
#
|
|
135
|
+
# @example Assert that a +subversion+ was synced with attributes
|
|
136
|
+
# expect(chef_run).to sync_subversion('svn://').with(user: 'svargo')
|
|
137
|
+
#
|
|
138
|
+
# @example Assert that a +subversion+ was synced using a regex
|
|
139
|
+
# expect(chef_run).to sync_subversion('svn://').with(user: /sva(.+)/)
|
|
140
|
+
#
|
|
141
|
+
# @example Assert that a +subversion+ was _not_ synced
|
|
142
|
+
# expect(chef_run).to_not sync_subversion('svn://')
|
|
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 sync_subversion(resource_name)
|
|
151
|
+
ChefSpec::Matchers::ResourceMatcher.new(:subversion, :sync, resource_name)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|