chefspec 7.0.0 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,80 +0,0 @@
|
|
1
|
-
module ChefSpec::API
|
2
|
-
# @since 6.0.0
|
3
|
-
module CabPackageMatchers
|
4
|
-
ChefSpec.define_matcher :cab_package
|
5
|
-
|
6
|
-
#
|
7
|
-
# Assert that a +cab_package+ resource exists in the Chef run with the
|
8
|
-
# action +:install+. Given a Chef Recipe that installs "apache2" as a
|
9
|
-
# +cab_package+:
|
10
|
-
#
|
11
|
-
# cab_package 'apache2' do
|
12
|
-
# action :install
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# The Examples section demonstrates the different ways to test a
|
16
|
-
# +cab_package+ resource with ChefSpec.
|
17
|
-
#
|
18
|
-
# @example Assert that a +cab_package+ was installed
|
19
|
-
# expect(chef_run).to install_cab_package('apache2')
|
20
|
-
#
|
21
|
-
# @example Assert that a +cab_package+ was installed with predicate matchers
|
22
|
-
# expect(chef_run).to install_cab_package('apache2').with_version('1.2.3')
|
23
|
-
#
|
24
|
-
# @example Assert that a +cab_package+ was installed with attributes
|
25
|
-
# expect(chef_run).to install_cab_package('apache2').with(version: '1.2.3')
|
26
|
-
#
|
27
|
-
# @example Assert that a +cab_package+ was installed using a regex
|
28
|
-
# expect(chef_run).to install_cab_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
29
|
-
#
|
30
|
-
# @example Assert that a +cab_package+ was _not_ installed
|
31
|
-
# expect(chef_run).to_not install_cab_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_cab_package(resource_name)
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:cab_package, :install, resource_name)
|
41
|
-
end
|
42
|
-
|
43
|
-
#
|
44
|
-
# Assert that a +cab_package+ resource exists in the Chef run with the
|
45
|
-
# action +:remove+. Given a Chef Recipe that removes "apache2" as a
|
46
|
-
# +cab_package+:
|
47
|
-
#
|
48
|
-
# cab_package 'apache2' do
|
49
|
-
# action :remove
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# The Examples section demonstrates the different ways to test a
|
53
|
-
# +cab_package+ resource with ChefSpec.
|
54
|
-
#
|
55
|
-
# @example Assert that a +cab_package+ was removed
|
56
|
-
# expect(chef_run).to remove_cab_package('apache2')
|
57
|
-
#
|
58
|
-
# @example Assert that a +cab_package+ was removed with predicate matchers
|
59
|
-
# expect(chef_run).to remove_cab_package('apache2').with_version('1.2.3')
|
60
|
-
#
|
61
|
-
# @example Assert that a +cab_package+ was removed with attributes
|
62
|
-
# expect(chef_run).to remove_cab_package('apache2').with(version: '1.2.3')
|
63
|
-
#
|
64
|
-
# @example Assert that a +cab_package+ was removed using a regex
|
65
|
-
# expect(chef_run).to remove_cab_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
66
|
-
#
|
67
|
-
# @example Assert that a +cab_package+ was _not_ removed
|
68
|
-
# expect(chef_run).to_not remove_cab_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_cab_package(resource_name)
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:cab_package, :remove, resource_name)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,191 +0,0 @@
|
|
1
|
-
module ChefSpec::API
|
2
|
-
# @since 0.8.0
|
3
|
-
module ChefGemMatchers
|
4
|
-
ChefSpec.define_matcher :chef_gem
|
5
|
-
|
6
|
-
#
|
7
|
-
# Assert that a +chef_gem+ resource exists in the Chef run with the
|
8
|
-
# action +:install+. Given a Chef Recipe that installs "community-zero" as a
|
9
|
-
# +chef_gem+:
|
10
|
-
#
|
11
|
-
# chef_gem 'community-zero' do
|
12
|
-
# action :install
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# The Examples section demonstrates the different ways to test a
|
16
|
-
# +chef_gem+ resource with ChefSpec.
|
17
|
-
#
|
18
|
-
# @example Assert that a +chef_gem+ was installed
|
19
|
-
# expect(chef_run).to install_chef_gem('community-zero')
|
20
|
-
#
|
21
|
-
# @example Assert that a +chef_gem+ was installed with predicate matchers
|
22
|
-
# expect(chef_run).to install_chef_gem('community-zero').with_version('1.2.3')
|
23
|
-
#
|
24
|
-
# @example Assert that a +chef_gem+ was installed with attributes
|
25
|
-
# expect(chef_run).to install_chef_gem('community-zero').with(version: '1.2.3')
|
26
|
-
#
|
27
|
-
# @example Assert that a +chef_gem+ was installed using a regex
|
28
|
-
# expect(chef_run).to install_chef_gem('community-zero').with(version: /(\d+\.){2}\.\d+/)
|
29
|
-
#
|
30
|
-
# @example Assert that a +chef_gem+ was _not_ installed
|
31
|
-
# expect(chef_run).to_not install_chef_gem('community-zero')
|
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_chef_gem(resource_name)
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:chef_gem, :install, resource_name)
|
41
|
-
end
|
42
|
-
|
43
|
-
#
|
44
|
-
# Assert that a +chef_gem+ resource exists in the Chef run with the
|
45
|
-
# action +:purge+. Given a Chef Recipe that purges "community-zero" as a
|
46
|
-
# +chef_gem+:
|
47
|
-
#
|
48
|
-
# chef_gem 'community-zero' do
|
49
|
-
# action :purge
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# The Examples section demonstrates the different ways to test a
|
53
|
-
# +chef_gem+ resource with ChefSpec.
|
54
|
-
#
|
55
|
-
# @example Assert that a +chef_gem+ was purgeed
|
56
|
-
# expect(chef_run).to purge_chef_gem('community-zero')
|
57
|
-
#
|
58
|
-
# @example Assert that a +chef_gem+ was purgeed with predicate matchers
|
59
|
-
# expect(chef_run).to purge_chef_gem('community-zero').with_version('1.2.3')
|
60
|
-
#
|
61
|
-
# @example Assert that a +chef_gem+ was purgeed with attributes
|
62
|
-
# expect(chef_run).to purge_chef_gem('community-zero').with(version: '1.2.3')
|
63
|
-
#
|
64
|
-
# @example Assert that a +chef_gem+ was purgeed using a regex
|
65
|
-
# expect(chef_run).to purge_chef_gem('community-zero').with(version: /(\d+\.){2}\.\d+/)
|
66
|
-
#
|
67
|
-
# @example Assert that a +chef_gem+ was _not_ purgeed
|
68
|
-
# expect(chef_run).to_not purge_chef_gem('community-zero')
|
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_chef_gem(resource_name)
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:chef_gem, :purge, resource_name)
|
78
|
-
end
|
79
|
-
|
80
|
-
#
|
81
|
-
# Assert that a +chef_gem+ resource exists in the Chef run with the
|
82
|
-
# action +:reconfig+. Given a Chef Recipe that reconfigures "community-zero"
|
83
|
-
# as a +chef_gem+:
|
84
|
-
#
|
85
|
-
# chef_gem 'community-zero' do
|
86
|
-
# action :reconfig
|
87
|
-
# end
|
88
|
-
#
|
89
|
-
# The Examples section demonstrates the different ways to test a
|
90
|
-
# +chef_gem+ resource with ChefSpec.
|
91
|
-
#
|
92
|
-
# @example Assert that a +chef_gem+ was reconfigured
|
93
|
-
# expect(chef_run).to reconfig_chef_gem('community-zero')
|
94
|
-
#
|
95
|
-
# @example Assert that a +chef_gem+ was reconfigured with predicate matchers
|
96
|
-
# expect(chef_run).to reconfig_chef_gem('community-zero').with_version('1.2.3')
|
97
|
-
#
|
98
|
-
# @example Assert that a +chef_gem+ was reconfigured with attributes
|
99
|
-
# expect(chef_run).to reconfig_chef_gem('community-zero').with(version: '1.2.3')
|
100
|
-
#
|
101
|
-
# @example Assert that a +chef_gem+ was reconfigured using a regex
|
102
|
-
# expect(chef_run).to reconfig_chef_gem('community-zero').with(version: /(\d+\.){2}\.\d+/)
|
103
|
-
#
|
104
|
-
# @example Assert that a +chef_gem+ was _not_ reconfigured
|
105
|
-
# expect(chef_run).to_not reconfig_chef_gem('community-zero')
|
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 reconfig_chef_gem(resource_name)
|
114
|
-
ChefSpec::Matchers::ResourceMatcher.new(:chef_gem, :reconfig, resource_name)
|
115
|
-
end
|
116
|
-
|
117
|
-
#
|
118
|
-
# Assert that a +chef_gem+ resource exists in the Chef run with the
|
119
|
-
# action +:remove+. Given a Chef Recipe that removes "community-zero" as a
|
120
|
-
# +chef_gem+:
|
121
|
-
#
|
122
|
-
# chef_gem 'community-zero' do
|
123
|
-
# action :remove
|
124
|
-
# end
|
125
|
-
#
|
126
|
-
# The Examples section demonstrates the different ways to test a
|
127
|
-
# +chef_gem+ resource with ChefSpec.
|
128
|
-
#
|
129
|
-
# @example Assert that a +chef_gem+ was removeed
|
130
|
-
# expect(chef_run).to remove_chef_gem('community-zero')
|
131
|
-
#
|
132
|
-
# @example Assert that a +chef_gem+ was removeed with predicate matchers
|
133
|
-
# expect(chef_run).to remove_chef_gem('community-zero').with_version('1.2.3')
|
134
|
-
#
|
135
|
-
# @example Assert that a +chef_gem+ was removeed with attributes
|
136
|
-
# expect(chef_run).to remove_chef_gem('community-zero').with(version: '1.2.3')
|
137
|
-
#
|
138
|
-
# @example Assert that a +chef_gem+ was removeed using a regex
|
139
|
-
# expect(chef_run).to remove_chef_gem('community-zero').with(version: /(\d+\.){2}\.\d+/)
|
140
|
-
#
|
141
|
-
# @example Assert that a +chef_gem+ was _not_ removeed
|
142
|
-
# expect(chef_run).to_not remove_chef_gem('community-zero')
|
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 remove_chef_gem(resource_name)
|
151
|
-
ChefSpec::Matchers::ResourceMatcher.new(:chef_gem, :remove, resource_name)
|
152
|
-
end
|
153
|
-
|
154
|
-
#
|
155
|
-
# Assert that a +chef_gem+ resource exists in the Chef run with the
|
156
|
-
# action +:upgrade+. Given a Chef Recipe that upgrades "community-zero" as a
|
157
|
-
# +chef_gem+:
|
158
|
-
#
|
159
|
-
# chef_gem 'community-zero' do
|
160
|
-
# action :upgrade
|
161
|
-
# end
|
162
|
-
#
|
163
|
-
# The Examples section demonstrates the different ways to test a
|
164
|
-
# +chef_gem+ resource with ChefSpec.
|
165
|
-
#
|
166
|
-
# @example Assert that a +chef_gem+ was upgradeed
|
167
|
-
# expect(chef_run).to upgrade_chef_gem('community-zero')
|
168
|
-
#
|
169
|
-
# @example Assert that a +chef_gem+ was upgradeed with predicate matchers
|
170
|
-
# expect(chef_run).to upgrade_chef_gem('community-zero').with_version('1.2.3')
|
171
|
-
#
|
172
|
-
# @example Assert that a +chef_gem+ was upgradeed with attributes
|
173
|
-
# expect(chef_run).to upgrade_chef_gem('community-zero').with(version: '1.2.3')
|
174
|
-
#
|
175
|
-
# @example Assert that a +chef_gem+ was upgradeed using a regex
|
176
|
-
# expect(chef_run).to upgrade_chef_gem('community-zero').with(version: /(\d+\.){2}\.\d+/)
|
177
|
-
#
|
178
|
-
# @example Assert that a +chef_gem+ was _not_ upgradeed
|
179
|
-
# expect(chef_run).to_not upgrade_chef_gem('community-zero')
|
180
|
-
#
|
181
|
-
#
|
182
|
-
# @param [String, Regex] resource_name
|
183
|
-
# the name of the resource to match
|
184
|
-
#
|
185
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
186
|
-
#
|
187
|
-
def upgrade_chef_gem(resource_name)
|
188
|
-
ChefSpec::Matchers::ResourceMatcher.new(:chef_gem, :upgrade, resource_name)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
module ChefSpec::API
|
2
|
-
# @since 4.6.0
|
3
|
-
module ChocolateyPackageMatchers
|
4
|
-
ChefSpec.define_matcher :chocolatey_package
|
5
|
-
#
|
6
|
-
# Assert that a +chocolatey_package+ resource exists in the Chef run with the
|
7
|
-
# action +:install+. Given a Chef Recipe that installs "7zip" as a
|
8
|
-
# +chocolatey_package+:
|
9
|
-
#
|
10
|
-
# chocolatey_package '7zip' do
|
11
|
-
# action :install
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
# The Examples section demonstrates the different ways to test a
|
15
|
-
# +chocolatey_package+ resource with ChefSpec.
|
16
|
-
#
|
17
|
-
# @example Assert that a +chocolatey_package+ was installed
|
18
|
-
# expect(chef_run).to install_chocolatey_package('7zip')
|
19
|
-
#
|
20
|
-
# @example Assert that a +chocolatey_package+ was installed with attributes
|
21
|
-
# expect(chef_run).to install_chocolatey_package('git').with(
|
22
|
-
# version: %w(2.7.1),
|
23
|
-
# options: '--params /GitAndUnixToolsOnPath'
|
24
|
-
# )
|
25
|
-
#
|
26
|
-
# @example Assert that a +chocolatey_package+ was _not_ installed
|
27
|
-
# expect(chef_run).to_not install_chocolatey_package('flashplayeractivex')
|
28
|
-
#
|
29
|
-
# @param [String, Regex] resource_name
|
30
|
-
# the name of the resource to match
|
31
|
-
#
|
32
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
33
|
-
#
|
34
|
-
def install_chocolatey_package(resource_name)
|
35
|
-
ChefSpec::Matchers::ResourceMatcher.new(:chocolatey_package, :install, resource_name)
|
36
|
-
end
|
37
|
-
|
38
|
-
#
|
39
|
-
# Assert that a +chocolatey_package+ resource exists in the Chef run with the
|
40
|
-
# action +:remove+. Given a Chef Recipe that removes "7zip" as a
|
41
|
-
# +chocolatey_package+:
|
42
|
-
#
|
43
|
-
# chocolatey_package '7zip' do
|
44
|
-
# action :remove
|
45
|
-
# end
|
46
|
-
#
|
47
|
-
# To test the content rendered by a +chocolatey_package+, see
|
48
|
-
# {ChefSpec::API::RenderFileMatchers}.
|
49
|
-
#
|
50
|
-
# The Examples section demonstrates the different ways to test a
|
51
|
-
# +chocolatey_package+ resource with ChefSpec.
|
52
|
-
#
|
53
|
-
# @example Assert that a +chocolatey_package+ was removed
|
54
|
-
# expect(chef_run).to remove_chocolatey_package('7zip')
|
55
|
-
#
|
56
|
-
# @example Assert that a specific +chocolatey_package+ version was removed
|
57
|
-
# expect(chef_run).to remove_chocolatey_package('7zip').with(
|
58
|
-
# version: %w(15.14)
|
59
|
-
# )
|
60
|
-
#
|
61
|
-
# @example Assert that a +chocolatey_package+ was _not_ removed
|
62
|
-
# expect(chef_run).to_not remove_chocolatey_package('7zip')
|
63
|
-
#
|
64
|
-
#
|
65
|
-
# @param [String, Regex] resource_name
|
66
|
-
# the name of the resource to match
|
67
|
-
#
|
68
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
69
|
-
#
|
70
|
-
def remove_chocolatey_package(resource_name)
|
71
|
-
ChefSpec::Matchers::ResourceMatcher.new(:chocolatey_package, :remove, resource_name)
|
72
|
-
end
|
73
|
-
|
74
|
-
#
|
75
|
-
# Assert that a +chocolatey_package+ resource exists in the Chef run with the
|
76
|
-
# action +:upgrade+. Given a Chef Recipe that upgrades "7zip" as a
|
77
|
-
# +chocolatey_package+:
|
78
|
-
#
|
79
|
-
# chocolatey_package '7zip' do
|
80
|
-
# action :upgrade
|
81
|
-
# end
|
82
|
-
#
|
83
|
-
# The Examples section demonstrates the different ways to test a
|
84
|
-
# +chocolatey_package+ resource with ChefSpec.
|
85
|
-
#
|
86
|
-
# @example Assert that a +chocolatey_package+ was upgraded
|
87
|
-
# expect(chef_run).to upgrade_chocolatey_package('7zip')
|
88
|
-
#
|
89
|
-
# @example Assert that a +chocolatey_package+ was upgraded with attributes
|
90
|
-
# expect(chef_run).to upgrade_chocolatey_package('git').with(
|
91
|
-
# version: %w(2.7.1),
|
92
|
-
# options: '-params "/GitAndUnixToolsOnPath"'
|
93
|
-
# )
|
94
|
-
#
|
95
|
-
# @example Assert that a +chocolatey_package+ was _not_ upgraded
|
96
|
-
# expect(chef_run).to_not upgrade_chocolatey_package('flashplayeractivex')
|
97
|
-
#
|
98
|
-
# @param [String, Regex] resource_name
|
99
|
-
# the name of the resource to match
|
100
|
-
#
|
101
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
102
|
-
#
|
103
|
-
def upgrade_chocolatey_package(resource_name)
|
104
|
-
ChefSpec::Matchers::ResourceMatcher.new(:chocolatey_package, :upgrade, resource_name)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,166 +0,0 @@
|
|
1
|
-
module ChefSpec::API
|
2
|
-
# @since 0.0.1
|
3
|
-
module CookbookFileMatchers
|
4
|
-
ChefSpec.define_matcher :cookbook_file
|
5
|
-
|
6
|
-
#
|
7
|
-
# Assert that a +cookbook_file+ resource exists in the Chef run with the
|
8
|
-
# action +:create+. Given a Chef Recipe that creates "/tmp/config" as a
|
9
|
-
# +cookbook_file+:
|
10
|
-
#
|
11
|
-
# cookbook_file '/tmp/config' do
|
12
|
-
# action :create
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# To test the content rendered by a +cookbook_file+, see
|
16
|
-
# {ChefSpec::API::RenderFileMatchers}.
|
17
|
-
#
|
18
|
-
# The Examples section demonstrates the different ways to test a
|
19
|
-
# +cookbook_file+ resource with ChefSpec.
|
20
|
-
#
|
21
|
-
# @example Assert that a +cookbook_file+ was created
|
22
|
-
# expect(chef_run).to create_cookbook_file('/tmp/config')
|
23
|
-
#
|
24
|
-
# @example Assert that a +cookbook_file+ was created with predicate matchers
|
25
|
-
# expect(chef_run).to create_cookbook_file('/tmp/config').with_backup(false)
|
26
|
-
#
|
27
|
-
# @example Assert that a +cookbook_file+ was created with attributes
|
28
|
-
# expect(chef_run).to create_cookbook_file('/tmp/config').with(backup: false)
|
29
|
-
#
|
30
|
-
# @example Assert that a +cookbook_file+ was created using a regex
|
31
|
-
# expect(chef_run).to create_cookbook_file('/tmp/config').with(user: /apa(.+)/)
|
32
|
-
#
|
33
|
-
# @example Assert that a +cookbook_file+ was _not_ created
|
34
|
-
# expect(chef_run).to_not create_cookbook_file('/tmp/config')
|
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 create_cookbook_file(resource_name)
|
43
|
-
ChefSpec::Matchers::ResourceMatcher.new(:cookbook_file, :create, resource_name)
|
44
|
-
end
|
45
|
-
|
46
|
-
#
|
47
|
-
# Assert that a +cookbook_file+ resource exists in the Chef run with the
|
48
|
-
# action +:create_if_missing+. Given a Chef Recipe that creates "/tmp/config"
|
49
|
-
# if missing as a +cookbook_file+:
|
50
|
-
#
|
51
|
-
# cookbook_file '/tmp/config' do
|
52
|
-
# action :create_if_missing
|
53
|
-
# end
|
54
|
-
#
|
55
|
-
# To test the content rendered by a +cookbook_file+, see
|
56
|
-
# {ChefSpec::API::RenderFileMatchers}.
|
57
|
-
#
|
58
|
-
# The Examples section demonstrates the different ways to test a
|
59
|
-
# +cookbook_file+ resource with ChefSpec.
|
60
|
-
#
|
61
|
-
# @example Assert that a +cookbook_file+ was created if missing
|
62
|
-
# expect(chef_run).to create_cookbook_file_if_missing('/tmp/config')
|
63
|
-
#
|
64
|
-
# @example Assert that a +cookbook_file+ was created if missing with predicate matchers
|
65
|
-
# expect(chef_run).to create_cookbook_file_if_missing('/tmp/config').with_backup(false)
|
66
|
-
#
|
67
|
-
# @example Assert that a +cookbook_file+ was created if missing with attributes
|
68
|
-
# expect(chef_run).to create_cookbook_file_if_missing('/tmp/config').with(backup: false)
|
69
|
-
#
|
70
|
-
# @example Assert that a +cookbook_file+ was created if missing using a regex
|
71
|
-
# expect(chef_run).to create_cookbook_file_if_missing('/tmp/config').with(user: /apa(.+)/)
|
72
|
-
#
|
73
|
-
# @example Assert that a +cookbook_file+ was _not_ created if missing
|
74
|
-
# expect(chef_run).to_not create_cookbook_file('/tmp/config')
|
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 create_cookbook_file_if_missing(resource_name)
|
83
|
-
ChefSpec::Matchers::ResourceMatcher.new(:cookbook_file, :create_if_missing, resource_name)
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
# Assert that a +cookbook_file+ resource exists in the Chef run with the
|
88
|
-
# action +:delete+. Given a Chef Recipe that deletes "/tmp/config" as a
|
89
|
-
# +cookbook_file+:
|
90
|
-
#
|
91
|
-
# cookbook_file '/tmp/config' do
|
92
|
-
# action :delete
|
93
|
-
# end
|
94
|
-
#
|
95
|
-
# To test the content rendered by a +cookbook_file+, see
|
96
|
-
# {ChefSpec::API::RenderFileMatchers}.
|
97
|
-
#
|
98
|
-
# The Examples section demonstrates the different ways to test a
|
99
|
-
# +cookbook_file+ resource with ChefSpec.
|
100
|
-
#
|
101
|
-
# @example Assert that a +cookbook_file+ was deleted
|
102
|
-
# expect(chef_run).to delete_cookbook_file('/tmp/config')
|
103
|
-
#
|
104
|
-
# @example Assert that a +cookbook_file+ was deleted with predicate matchers
|
105
|
-
# expect(chef_run).to delete_cookbook_file('/tmp/config').with_backup(false)
|
106
|
-
#
|
107
|
-
# @example Assert that a +cookbook_file+ was deleted with attributes
|
108
|
-
# expect(chef_run).to delete_cookbook_file('/tmp/config').with(backup: false)
|
109
|
-
#
|
110
|
-
# @example Assert that a +cookbook_file+ was deleted using a regex
|
111
|
-
# expect(chef_run).to delete_cookbook_file('/tmp/config').with(user: /apa(.+)/)
|
112
|
-
#
|
113
|
-
# @example Assert that a +cookbook_file+ was _not_ deleted
|
114
|
-
# expect(chef_run).to_not delete_cookbook_file('/tmp/config')
|
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 delete_cookbook_file(resource_name)
|
123
|
-
ChefSpec::Matchers::ResourceMatcher.new(:cookbook_file, :delete, resource_name)
|
124
|
-
end
|
125
|
-
|
126
|
-
#
|
127
|
-
# Assert that a +cookbook_file+ resource exists in the Chef run with the
|
128
|
-
# action +:touch+. Given a Chef Recipe that touches "/tmp/config" as a
|
129
|
-
# +cookbook_file+:
|
130
|
-
#
|
131
|
-
# cookbook_file '/tmp/config' do
|
132
|
-
# action :touch
|
133
|
-
# end
|
134
|
-
#
|
135
|
-
# To test the content rendered by a +cookbook_file+, see
|
136
|
-
# {ChefSpec::API::RenderFileMatchers}.
|
137
|
-
#
|
138
|
-
# The Examples section demonstrates the different ways to test a
|
139
|
-
# +cookbook_file+ resource with ChefSpec.
|
140
|
-
#
|
141
|
-
# @example Assert that a +cookbook_file+ was touched
|
142
|
-
# expect(chef_run).to touch_cookbook_file('/tmp/config')
|
143
|
-
#
|
144
|
-
# @example Assert that a +cookbook_file+ was touched with predicate matchers
|
145
|
-
# expect(chef_run).to touch_cookbook_file('/tmp/config').with_backup(false)
|
146
|
-
#
|
147
|
-
# @example Assert that a +cookbook_file+ was touched with attributes
|
148
|
-
# expect(chef_run).to touch_cookbook_file('/tmp/config').with(backup: false)
|
149
|
-
#
|
150
|
-
# @example Assert that a +cookbook_file+ was touched using a regex
|
151
|
-
# expect(chef_run).to touch_cookbook_file('/tmp/config').with(user: /apa(.+)/)
|
152
|
-
#
|
153
|
-
# @example Assert that a +cookbook_file+ was _not_ touched
|
154
|
-
# expect(chef_run).to_not touch_cookbook_file('/tmp/config')
|
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 touch_cookbook_file(resource_name)
|
163
|
-
ChefSpec::Matchers::ResourceMatcher.new(:cookbook_file, :touch, resource_name)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|