chefspec 7.0.0 → 7.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/Gemfile +6 -0
- data/README.md +43 -11
- data/Rakefile +48 -8
- data/chefspec.gemspec +0 -8
- data/examples/cab_package/spec/install_spec.rb +20 -18
- data/examples/cab_package/spec/remove_spec.rb +17 -15
- data/examples/cached/spec/default_spec.rb +1 -0
- data/examples/compile_time/spec/default_spec.rb +2 -0
- data/examples/custom_matcher/libraries/matcher.rb +1 -23
- data/examples/dnf_package/spec/install_spec.rb +20 -18
- data/examples/dnf_package/spec/purge_spec.rb +17 -15
- data/examples/dnf_package/spec/remove_spec.rb +17 -15
- data/examples/dnf_package/spec/upgrade_spec.rb +17 -15
- data/examples/heavy_provider_light_resource/spec/provider_service_spec.rb +1 -0
- data/examples/msu_package/spec/install_spec.rb +20 -18
- data/examples/msu_package/spec/remove_spec.rb +17 -15
- data/examples/server/spec/exotic_port_spec.rb +15 -2
- data/lib/chefspec.rb +1 -8
- data/lib/chefspec/api.rb +6 -84
- data/lib/chefspec/api/do_nothing.rb +18 -21
- data/lib/chefspec/api/include_recipe.rb +20 -23
- data/lib/chefspec/api/link.rb +20 -99
- data/lib/chefspec/api/notifications.rb +32 -35
- data/lib/chefspec/api/reboot.rb +5 -14
- data/lib/chefspec/api/render_file.rb +29 -32
- data/lib/chefspec/api/state_attrs.rb +22 -25
- data/lib/chefspec/api/subscriptions.rb +29 -32
- data/lib/chefspec/api/user.rb +216 -219
- data/lib/chefspec/extensions.rb +16 -0
- data/lib/chefspec/extensions/chef/resource.rb +90 -8
- data/lib/chefspec/version.rb +1 -1
- data/lib/chefspec/zero_server.rb +20 -18
- metadata +3 -313
- data/examples/custom_resource/libraries/matchers.rb +0 -5
- data/examples/use_inline_resources/libraries/matchers.rb +0 -5
- data/features/apt_package.feature +0 -14
- data/features/apt_repository.feature +0 -15
- data/features/apt_update.feature +0 -13
- data/features/attributes.feature +0 -7
- data/features/batch.feature +0 -10
- data/features/bff_package.feature +0 -12
- data/features/cab_package.feature +0 -21
- data/features/cached.feature +0 -7
- data/features/chef_gem.feature +0 -14
- data/features/chocolatey_package.feature +0 -14
- data/features/compile_time.feature +0 -7
- data/features/cookbook_file.feature +0 -13
- data/features/cron.feature +0 -11
- data/features/custom_matcher.feature +0 -11
- data/features/custom_resource.feature +0 -7
- data/features/deploy.feature +0 -12
- data/features/directory.feature +0 -11
- data/features/dnf_package.feature +0 -26
- data/features/do_nothing.feature +0 -10
- data/features/dpkg_package.feature +0 -12
- data/features/dsc_resource.feature +0 -10
- data/features/dsc_script.feature +0 -10
- data/features/env.feature +0 -12
- data/features/erl_call.feature +0 -10
- data/features/execute.feature +0 -10
- data/features/exotic_zero_port.feature +0 -7
- data/features/expect_exception.feature +0 -12
- data/features/file.feature +0 -13
- data/features/freebsd_package.feature +0 -11
- data/features/gem_package.feature +0 -14
- data/features/git.feature +0 -12
- data/features/group.feature +0 -13
- data/features/guards.feature +0 -10
- data/features/heavy_provider_light_resource.feature +0 -10
- data/features/homebrew_package.feature +0 -12
- data/features/http_request.feature +0 -15
- data/features/ifconfig.feature +0 -13
- data/features/include_recipe.feature +0 -10
- data/features/ips_package.feature +0 -12
- data/features/launchd.feature +0 -17
- data/features/link.feature +0 -12
- data/features/log.feature +0 -10
- data/features/macports_package.feature +0 -13
- data/features/mdadm.feature +0 -12
- data/features/mount.feature +0 -14
- data/features/msu_package.feature +0 -23
- data/features/multiple_actions.feature +0 -12
- data/features/multiple_run_action.feature +0 -7
- data/features/notifications.feature +0 -14
- data/features/ohai.feature +0 -10
- data/features/openbsd_package.feature +0 -12
- data/features/osx_profile.feature +0 -13
- data/features/package.feature +0 -14
- data/features/pacman_package.feature +0 -13
- data/features/paludis_package.feature +0 -12
- data/features/portage_package.feature +0 -13
- data/features/powershell_script.feature +0 -10
- data/features/reboot.feature +0 -12
- data/features/registry_key.feature +0 -13
- data/features/remote_directory.feature +0 -12
- data/features/remote_file.feature +0 -13
- data/features/render_file.feature +0 -11
- data/features/roles.feature +0 -7
- data/features/route.feature +0 -11
- data/features/rpm_package.feature +0 -12
- data/features/ruby_block.feature +0 -11
- data/features/script.feature +0 -16
- data/features/server.feature +0 -16
- data/features/server_on_disk.feature +0 -16
- data/features/service.feature +0 -15
- data/features/smartos_package.feature +0 -12
- data/features/solaris_package.feature +0 -12
- data/features/state_attrs.feature +0 -7
- data/features/step_definitions/background_steps.rb +0 -7
- data/features/step_into.feature +0 -7
- data/features/stub_command.feature +0 -7
- data/features/stub_data_bag.feature +0 -7
- data/features/stub_data_bag_item.feature +0 -7
- data/features/stub_node.feature +0 -7
- data/features/stub_search.feature +0 -7
- data/features/subscribes.feature +0 -14
- data/features/subversion.feature +0 -13
- data/features/support/env.rb +0 -38
- data/features/support/executor.rb +0 -20
- data/features/support/exotic_zero_port.rb +0 -3
- data/features/support/on_disk.rb +0 -7
- data/features/systemd_unit.feature +0 -27
- data/features/template.feature +0 -13
- data/features/use_inline_resources.feature +0 -7
- data/features/user.feature +0 -15
- data/features/windows_package.feature +0 -11
- data/features/windows_service.feature +0 -16
- data/features/yum_package.feature +0 -13
- data/features/yum_repository.feature +0 -23
- data/features/zypper_package.feature +0 -13
- data/lib/chefspec/api/apt_package.rb +0 -192
- data/lib/chefspec/api/apt_repository.rb +0 -56
- data/lib/chefspec/api/apt_update.rb +0 -53
- data/lib/chefspec/api/batch.rb +0 -43
- data/lib/chefspec/api/bff_package.rb +0 -154
- data/lib/chefspec/api/cab_package.rb +0 -80
- data/lib/chefspec/api/chef_gem.rb +0 -191
- data/lib/chefspec/api/chocolatey_package.rb +0 -107
- data/lib/chefspec/api/cookbook_file.rb +0 -166
- data/lib/chefspec/api/cron.rb +0 -80
- data/lib/chefspec/api/deploy.rb +0 -117
- data/lib/chefspec/api/directory.rb +0 -80
- data/lib/chefspec/api/dnf_package.rb +0 -154
- data/lib/chefspec/api/dpkg_package.rb +0 -117
- data/lib/chefspec/api/dsc_resource.rb +0 -49
- data/lib/chefspec/api/dsc_script.rb +0 -37
- data/lib/chefspec/api/easy_install_package.rb +0 -154
- data/lib/chefspec/api/env.rb +0 -117
- data/lib/chefspec/api/erl_call.rb +0 -43
- data/lib/chefspec/api/execute.rb +0 -43
- data/lib/chefspec/api/file.rb +0 -166
- data/lib/chefspec/api/freebsd_package.rb +0 -80
- data/lib/chefspec/api/gem_package.rb +0 -191
- data/lib/chefspec/api/git.rb +0 -117
- data/lib/chefspec/api/group.rb +0 -154
- data/lib/chefspec/api/homebrew_package.rb +0 -154
- data/lib/chefspec/api/http_request.rb +0 -228
- data/lib/chefspec/api/ifconfig.rb +0 -154
- data/lib/chefspec/api/ips_package.rb +0 -117
- data/lib/chefspec/api/launchd.rb +0 -151
- data/lib/chefspec/api/log.rb +0 -43
- data/lib/chefspec/api/macports_package.rb +0 -154
- data/lib/chefspec/api/mdadm.rb +0 -117
- data/lib/chefspec/api/mount.rb +0 -192
- data/lib/chefspec/api/msu_package.rb +0 -81
- data/lib/chefspec/api/ohai.rb +0 -43
- data/lib/chefspec/api/openbsd_package.rb +0 -155
- data/lib/chefspec/api/osx_profile.rb +0 -63
- data/lib/chefspec/api/package.rb +0 -192
- data/lib/chefspec/api/pacman_package.rb +0 -155
- data/lib/chefspec/api/paludis_package.rb +0 -155
- data/lib/chefspec/api/portage_package.rb +0 -155
- data/lib/chefspec/api/powershell_script.rb +0 -43
- data/lib/chefspec/api/registry_key.rb +0 -166
- data/lib/chefspec/api/remote_directory.rb +0 -120
- data/lib/chefspec/api/remote_file.rb +0 -166
- data/lib/chefspec/api/route.rb +0 -80
- data/lib/chefspec/api/rpm_package.rb +0 -117
- data/lib/chefspec/api/ruby_block.rb +0 -68
- data/lib/chefspec/api/script.rb +0 -278
- data/lib/chefspec/api/service.rb +0 -246
- data/lib/chefspec/api/smartos_package.rb +0 -117
- data/lib/chefspec/api/solaris_package.rb +0 -117
- data/lib/chefspec/api/subversion.rb +0 -154
- data/lib/chefspec/api/systemd_unit.rb +0 -353
- data/lib/chefspec/api/template.rb +0 -166
- data/lib/chefspec/api/windows_package.rb +0 -86
- data/lib/chefspec/api/windows_service.rb +0 -286
- data/lib/chefspec/api/yum_package.rb +0 -154
- data/lib/chefspec/api/yum_repository.rb +0 -130
- data/lib/chefspec/api/zypper_package.rb +0 -154
- data/spec/unit/api_spec.rb +0 -18
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
module ChefSpec::API
|
|
2
|
-
# @since 3.0.0
|
|
3
|
-
module IfconfigMatchers
|
|
4
|
-
ChefSpec.define_matcher :ifconfig
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
# Assert that an +ifconfig+ resource exists in the Chef run with the
|
|
8
|
-
# action +:add+. Given a Chef Recipe that adds "10.0.0.1" as an
|
|
9
|
-
# +ifconfig+:
|
|
10
|
-
#
|
|
11
|
-
# ifconfig '10.0.0.1' do
|
|
12
|
-
# action :add
|
|
13
|
-
# end
|
|
14
|
-
#
|
|
15
|
-
# The Examples section demonstrates the different ways to test an
|
|
16
|
-
# +ifconfig+ resource with ChefSpec.
|
|
17
|
-
#
|
|
18
|
-
# @example Assert that an +ifconfig+ was added
|
|
19
|
-
# expect(chef_run).to add_ifconfig('10.0.0.1')
|
|
20
|
-
#
|
|
21
|
-
# @example Assert that an +ifconfig+ was added with predicate matchers
|
|
22
|
-
# expect(chef_run).to add_ifconfig('10.0.0.1').with_device('eth0')
|
|
23
|
-
#
|
|
24
|
-
# @example Assert that an +ifconfig+ was added with attributes
|
|
25
|
-
# expect(chef_run).to add_ifconfig('10.0.0.1').with(device: 'eth0')
|
|
26
|
-
#
|
|
27
|
-
# @example Assert that an +ifconfig+ was added using a regex
|
|
28
|
-
# expect(chef_run).to add_ifconfig('10.0.0.1').with(device: /eth(\d+)/)
|
|
29
|
-
#
|
|
30
|
-
# @example Assert that an +ifconfig+ was _not_ added
|
|
31
|
-
# expect(chef_run).to_not add_ifconfig('10.0.0.1')
|
|
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 add_ifconfig(resource_name)
|
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ifconfig, :add, resource_name)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
# Assert that an +ifconfig+ resource exists in the Chef run with the
|
|
45
|
-
# action +:delete+. Given a Chef Recipe that deletes "10.0.0.1" as an
|
|
46
|
-
# +ifconfig+:
|
|
47
|
-
#
|
|
48
|
-
# ifconfig '10.0.0.1' do
|
|
49
|
-
# action :delete
|
|
50
|
-
# end
|
|
51
|
-
#
|
|
52
|
-
# The Examples section demonstrates the different ways to test an
|
|
53
|
-
# +ifconfig+ resource with ChefSpec.
|
|
54
|
-
#
|
|
55
|
-
# @example Assert that an +ifconfig+ was deleted
|
|
56
|
-
# expect(chef_run).to delete_ifconfig('10.0.0.1')
|
|
57
|
-
#
|
|
58
|
-
# @example Assert that an +ifconfig+ was deleted with predicate matchers
|
|
59
|
-
# expect(chef_run).to delete_ifconfig('10.0.0.1').with_device('eth0')
|
|
60
|
-
#
|
|
61
|
-
# @example Assert that an +ifconfig+ was deleted with attributes
|
|
62
|
-
# expect(chef_run).to delete_ifconfig('10.0.0.1').with(device: 'eth0')
|
|
63
|
-
#
|
|
64
|
-
# @example Assert that an +ifconfig+ was deleted using a regex
|
|
65
|
-
# expect(chef_run).to delete_ifconfig('10.0.0.1').with(device: /eth(\d+)/)
|
|
66
|
-
#
|
|
67
|
-
# @example Assert that an +ifconfig+ was _not_ deleted
|
|
68
|
-
# expect(chef_run).to_not delete_ifconfig('10.0.0.1')
|
|
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 delete_ifconfig(resource_name)
|
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ifconfig, :delete, resource_name)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
#
|
|
81
|
-
# Assert that an +ifconfig+ resource exists in the Chef run with the
|
|
82
|
-
# action +:disable+. Given a Chef Recipe that disables "10.0.0.1" as an
|
|
83
|
-
# +ifconfig+:
|
|
84
|
-
#
|
|
85
|
-
# ifconfig '10.0.0.1' do
|
|
86
|
-
# action :disable
|
|
87
|
-
# end
|
|
88
|
-
#
|
|
89
|
-
# The Examples section demonstrates the different ways to test an
|
|
90
|
-
# +ifconfig+ resource with ChefSpec.
|
|
91
|
-
#
|
|
92
|
-
# @example Assert that an +ifconfig+ was disabled
|
|
93
|
-
# expect(chef_run).to disable_ifconfig('10.0.0.1')
|
|
94
|
-
#
|
|
95
|
-
# @example Assert that an +ifconfig+ was disabled with predicate matchers
|
|
96
|
-
# expect(chef_run).to disable_ifconfig('10.0.0.1').with_device('eth0')
|
|
97
|
-
#
|
|
98
|
-
# @example Assert that an +ifconfig+ was disabled with attributes
|
|
99
|
-
# expect(chef_run).to disable_ifconfig('10.0.0.1').with(device: 'eth0')
|
|
100
|
-
#
|
|
101
|
-
# @example Assert that an +ifconfig+ was disabled using a regex
|
|
102
|
-
# expect(chef_run).to disable_ifconfig('10.0.0.1').with(device: /eth(\d+)/)
|
|
103
|
-
#
|
|
104
|
-
# @example Assert that an +ifconfig+ was _not_ disabled
|
|
105
|
-
# expect(chef_run).to_not disable_ifconfig('10.0.0.1')
|
|
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 disable_ifconfig(resource_name)
|
|
114
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ifconfig, :disable, resource_name)
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
#
|
|
118
|
-
# Assert that an +ifconfig+ resource exists in the Chef run with the
|
|
119
|
-
# action +:enable+. Given a Chef Recipe that enables "10.0.0.1" as an
|
|
120
|
-
# +ifconfig+:
|
|
121
|
-
#
|
|
122
|
-
# ifconfig '10.0.0.1' do
|
|
123
|
-
# action :enable
|
|
124
|
-
# end
|
|
125
|
-
#
|
|
126
|
-
# The Examples section demonstrates the different ways to test an
|
|
127
|
-
# +ifconfig+ resource with ChefSpec.
|
|
128
|
-
#
|
|
129
|
-
# @example Assert that an +ifconfig+ was enabled
|
|
130
|
-
# expect(chef_run).to enable_ifconfig('10.0.0.1')
|
|
131
|
-
#
|
|
132
|
-
# @example Assert that an +ifconfig+ was enabled with predicate matchers
|
|
133
|
-
# expect(chef_run).to enable_ifconfig('10.0.0.1').with_device('eth0')
|
|
134
|
-
#
|
|
135
|
-
# @example Assert that an +ifconfig+ was enabled with attributes
|
|
136
|
-
# expect(chef_run).to enable_ifconfig('10.0.0.1').with(device: 'eth0')
|
|
137
|
-
#
|
|
138
|
-
# @example Assert that an +ifconfig+ was enabled using a regex
|
|
139
|
-
# expect(chef_run).to enable_ifconfig('10.0.0.1').with(device: /eth(\d+)/)
|
|
140
|
-
#
|
|
141
|
-
# @example Assert that an +ifconfig+ was _not_ enabled
|
|
142
|
-
# expect(chef_run).to_not enable_ifconfig('10.0.0.1')
|
|
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 enable_ifconfig(resource_name)
|
|
151
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ifconfig, :enable, resource_name)
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
end
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
module ChefSpec::API
|
|
2
|
-
# @since 3.0.0
|
|
3
|
-
module IpsPackageMatchers
|
|
4
|
-
ChefSpec.define_matcher :ips_package
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
# Assert that an +ips_package+ resource exists in the Chef run with the
|
|
8
|
-
# action +:install+. Given a Chef Recipe that installs "apache2" as an
|
|
9
|
-
# +ips_package+:
|
|
10
|
-
#
|
|
11
|
-
# ips_package 'apache2' do
|
|
12
|
-
# action :install
|
|
13
|
-
# end
|
|
14
|
-
#
|
|
15
|
-
# The Examples section demonstrates the different ways to test an
|
|
16
|
-
# +ips_package+ resource with ChefSpec.
|
|
17
|
-
#
|
|
18
|
-
# @example Assert that an +ips_package+ was installed
|
|
19
|
-
# expect(chef_run).to install_ips_package('apache2')
|
|
20
|
-
#
|
|
21
|
-
# @example Assert that an +ips_package+ was installed with predicate matchers
|
|
22
|
-
# expect(chef_run).to install_ips_package('apache2').with_version('1.2.3')
|
|
23
|
-
#
|
|
24
|
-
# @example Assert that an +ips_package+ was installed with attributes
|
|
25
|
-
# expect(chef_run).to install_ips_package('apache2').with(version: '1.2.3')
|
|
26
|
-
#
|
|
27
|
-
# @example Assert that an +ips_package+ was installed using a regex
|
|
28
|
-
# expect(chef_run).to install_ips_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
29
|
-
#
|
|
30
|
-
# @example Assert that an +ips_package+ was _not_ installed
|
|
31
|
-
# expect(chef_run).to_not install_ips_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_ips_package(resource_name)
|
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ips_package, :install, resource_name)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
# Assert that an +ips_package+ resource exists in the Chef run with the
|
|
45
|
-
# action +:remove+. Given a Chef Recipe that removes "apache2" as an
|
|
46
|
-
# +ips_package+:
|
|
47
|
-
#
|
|
48
|
-
# ips_package 'apache2' do
|
|
49
|
-
# action :remove
|
|
50
|
-
# end
|
|
51
|
-
#
|
|
52
|
-
# The Examples section demonstrates the different ways to test an
|
|
53
|
-
# +ips_package+ resource with ChefSpec.
|
|
54
|
-
#
|
|
55
|
-
# @example Assert that an +ips_package+ was removed
|
|
56
|
-
# expect(chef_run).to remove_ips_package('apache2')
|
|
57
|
-
#
|
|
58
|
-
# @example Assert that an +ips_package+ was removed with predicate matchers
|
|
59
|
-
# expect(chef_run).to remove_ips_package('apache2').with_version('1.2.3')
|
|
60
|
-
#
|
|
61
|
-
# @example Assert that an +ips_package+ was removed with attributes
|
|
62
|
-
# expect(chef_run).to remove_ips_package('apache2').with(version: '1.2.3')
|
|
63
|
-
#
|
|
64
|
-
# @example Assert that an +ips_package+ was removed using a regex
|
|
65
|
-
# expect(chef_run).to remove_ips_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
66
|
-
#
|
|
67
|
-
# @example Assert that an +ips_package+ was _not_ removed
|
|
68
|
-
# expect(chef_run).to_not remove_ips_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_ips_package(resource_name)
|
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ips_package, :remove, resource_name)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
#
|
|
81
|
-
# Assert that an +ips_package+ resource exists in the Chef run with the
|
|
82
|
-
# action +:upgrade+. Given a Chef Recipe that upgrades "apache2" as an
|
|
83
|
-
# +ips_package+:
|
|
84
|
-
#
|
|
85
|
-
# ips_package 'apache2' do
|
|
86
|
-
# action :upgrade
|
|
87
|
-
# end
|
|
88
|
-
#
|
|
89
|
-
# The Examples section demonstrates the different ways to test an
|
|
90
|
-
# +ips_package+ resource with ChefSpec.
|
|
91
|
-
#
|
|
92
|
-
# @example Assert that an +ips_package+ was upgradeed
|
|
93
|
-
# expect(chef_run).to upgrade_ips_package('apache2')
|
|
94
|
-
#
|
|
95
|
-
# @example Assert that an +ips_package+ was upgradeed with predicate matchers
|
|
96
|
-
# expect(chef_run).to upgrade_ips_package('apache2').with_version('1.2.3')
|
|
97
|
-
#
|
|
98
|
-
# @example Assert that an +ips_package+ was upgradeed with attributes
|
|
99
|
-
# expect(chef_run).to upgrade_ips_package('apache2').with(version: '1.2.3')
|
|
100
|
-
#
|
|
101
|
-
# @example Assert that an +ips_package+ was upgradeed using a regex
|
|
102
|
-
# expect(chef_run).to upgrade_ips_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
103
|
-
#
|
|
104
|
-
# @example Assert that an +ips_package+ was _not_ upgradeed
|
|
105
|
-
# expect(chef_run).to_not upgrade_ips_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_ips_package(resource_name)
|
|
114
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ips_package, :upgrade, resource_name)
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
data/lib/chefspec/api/launchd.rb
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
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
|
data/lib/chefspec/api/log.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module ChefSpec::API
|
|
2
|
-
# @since 3.0.0
|
|
3
|
-
module LogMatchers
|
|
4
|
-
ChefSpec.define_matcher :log
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
# Assert that a +log+ resource exists in the Chef run with the
|
|
8
|
-
# action +:write+. Given a Chef Recipe that writes "message" as a
|
|
9
|
-
# +log+:
|
|
10
|
-
#
|
|
11
|
-
# log 'message' do
|
|
12
|
-
# action :write
|
|
13
|
-
# end
|
|
14
|
-
#
|
|
15
|
-
# The Examples section demonstrates the different ways to test a
|
|
16
|
-
# +log+ resource with ChefSpec.
|
|
17
|
-
#
|
|
18
|
-
# @example Assert that a +log+ was writeed
|
|
19
|
-
# expect(chef_run).to write_log('message')
|
|
20
|
-
#
|
|
21
|
-
# @example Assert that a +log+ was writeed with predicate matchers
|
|
22
|
-
# expect(chef_run).to write_log('message').with_level(:info)
|
|
23
|
-
#
|
|
24
|
-
# @example Assert that a +log+ was writeed with attributes
|
|
25
|
-
# expect(chef_run).to write_log('message').with(level: :info)
|
|
26
|
-
#
|
|
27
|
-
# @example Assert that a +log+ was writeed using a regex
|
|
28
|
-
# expect(chef_run).to write_log('message').with(level: Symbol)
|
|
29
|
-
#
|
|
30
|
-
# @example Assert that a +log+ was _not_ writeed
|
|
31
|
-
# expect(chef_run).to_not write_log('message')
|
|
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 write_log(resource_name)
|
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:log, :write, resource_name)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|