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
data/lib/chefspec/api/route.rb
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
module ChefSpec::API
|
|
2
|
-
# @since 3.0.0
|
|
3
|
-
module RouteMatchers
|
|
4
|
-
ChefSpec.define_matcher :route
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
# Assert that a +route+ resource exists in the Chef run with the
|
|
8
|
-
# action +:add+. Given a Chef Recipe that adds "10.0.0.10/32" as a
|
|
9
|
-
# +route+:
|
|
10
|
-
#
|
|
11
|
-
# route '10.0.0.10/32' do
|
|
12
|
-
# action :add
|
|
13
|
-
# end
|
|
14
|
-
#
|
|
15
|
-
# The Examples section demonstrates the different ways to test a
|
|
16
|
-
# +route+ resource with ChefSpec.
|
|
17
|
-
#
|
|
18
|
-
# @example Assert that a +route+ was added
|
|
19
|
-
# expect(chef_run).to add_route('10.0.0.10/32')
|
|
20
|
-
#
|
|
21
|
-
# @example Assert that a +route+ was added with predicate matchers
|
|
22
|
-
# expect(chef_run).to add_route('10.0.0.10/32').with_device('eth0')
|
|
23
|
-
#
|
|
24
|
-
# @example Assert that a +route+ was added with attributes
|
|
25
|
-
# expect(chef_run).to add_route('10.0.0.10/32').with(device: 'eth0')
|
|
26
|
-
#
|
|
27
|
-
# @example Assert that a +route+ was added using a regex
|
|
28
|
-
# expect(chef_run).to add_route('10.0.0.10/32').with(device: /eth(\d+)/)
|
|
29
|
-
#
|
|
30
|
-
# @example Assert that a +route+ was _not_ added
|
|
31
|
-
# expect(chef_run).to_not add_route('10.0.0.10/32')
|
|
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_route(resource_name)
|
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:route, :add, resource_name)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
# Assert that a +route+ resource exists in the Chef run with the
|
|
45
|
-
# action +:delete+. Given a Chef Recipe that deletes "10.0.0.10/32" as a
|
|
46
|
-
# +route+:
|
|
47
|
-
#
|
|
48
|
-
# route '10.0.0.10/32' do
|
|
49
|
-
# action :delete
|
|
50
|
-
# end
|
|
51
|
-
#
|
|
52
|
-
# The Examples section demonstrates the different ways to test a
|
|
53
|
-
# +route+ resource with ChefSpec.
|
|
54
|
-
#
|
|
55
|
-
# @example Assert that a +route+ was deleted
|
|
56
|
-
# expect(chef_run).to delete_route('10.0.0.10/32')
|
|
57
|
-
#
|
|
58
|
-
# @example Assert that a +route+ was deleted with predicate matchers
|
|
59
|
-
# expect(chef_run).to delete_route('10.0.0.10/32').with_device('eth0')
|
|
60
|
-
#
|
|
61
|
-
# @example Assert that a +route+ was deleted with attributes
|
|
62
|
-
# expect(chef_run).to delete_route('10.0.0.10/32').with(device: 'eth0')
|
|
63
|
-
#
|
|
64
|
-
# @example Assert that a +route+ was deleted using a regex
|
|
65
|
-
# expect(chef_run).to delete_route('10.0.0.10/32').with(device: /eth(\d+)/)
|
|
66
|
-
#
|
|
67
|
-
# @example Assert that a +route+ was _not_ deleted
|
|
68
|
-
# expect(chef_run).to_not delete_route('10.0.0.10/32')
|
|
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_route(resource_name)
|
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:route, :delete, resource_name)
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
module ChefSpec::API
|
|
2
|
-
# @since 3.0.0
|
|
3
|
-
module RpmPackageMatchers
|
|
4
|
-
ChefSpec.define_matcher :rpm_package
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
# Assert that a +rpm_package+ resource exists in the Chef run with the
|
|
8
|
-
# action +:install+. Given a Chef Recipe that installs "apache2" as a
|
|
9
|
-
# +rpm_package+:
|
|
10
|
-
#
|
|
11
|
-
# rpm_package 'apache2' do
|
|
12
|
-
# action :install
|
|
13
|
-
# end
|
|
14
|
-
#
|
|
15
|
-
# The Examples section demonstrates the different ways to test a
|
|
16
|
-
# +rpm_package+ resource with ChefSpec.
|
|
17
|
-
#
|
|
18
|
-
# @example Assert that a +rpm_package+ was installed
|
|
19
|
-
# expect(chef_run).to install_rpm_package('apache2')
|
|
20
|
-
#
|
|
21
|
-
# @example Assert that a +rpm_package+ was installed with predicate matchers
|
|
22
|
-
# expect(chef_run).to install_rpm_package('apache2').with_version('1.2.3')
|
|
23
|
-
#
|
|
24
|
-
# @example Assert that a +rpm_package+ was installed with attributes
|
|
25
|
-
# expect(chef_run).to install_rpm_package('apache2').with(version: '1.2.3')
|
|
26
|
-
#
|
|
27
|
-
# @example Assert that a +rpm_package+ was installed using a regex
|
|
28
|
-
# expect(chef_run).to install_rpm_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
29
|
-
#
|
|
30
|
-
# @example Assert that a +rpm_package+ was _not_ installed
|
|
31
|
-
# expect(chef_run).to_not install_rpm_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_rpm_package(resource_name)
|
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:rpm_package, :install, resource_name)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
# Assert that a +rpm_package+ resource exists in the Chef run with the
|
|
45
|
-
# action +:remove+. Given a Chef Recipe that removes "apache2" as a
|
|
46
|
-
# +rpm_package+:
|
|
47
|
-
#
|
|
48
|
-
# rpm_package 'apache2' do
|
|
49
|
-
# action :remove
|
|
50
|
-
# end
|
|
51
|
-
#
|
|
52
|
-
# The Examples section demonstrates the different ways to test a
|
|
53
|
-
# +rpm_package+ resource with ChefSpec.
|
|
54
|
-
#
|
|
55
|
-
# @example Assert that a +rpm_package+ was removed
|
|
56
|
-
# expect(chef_run).to remove_rpm_package('apache2')
|
|
57
|
-
#
|
|
58
|
-
# @example Assert that a +rpm_package+ was removed with predicate matchers
|
|
59
|
-
# expect(chef_run).to remove_rpm_package('apache2').with_version('1.2.3')
|
|
60
|
-
#
|
|
61
|
-
# @example Assert that a +rpm_package+ was removed with attributes
|
|
62
|
-
# expect(chef_run).to remove_rpm_package('apache2').with(version: '1.2.3')
|
|
63
|
-
#
|
|
64
|
-
# @example Assert that a +rpm_package+ was removed using a regex
|
|
65
|
-
# expect(chef_run).to remove_rpm_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
66
|
-
#
|
|
67
|
-
# @example Assert that a +rpm_package+ was _not_ removed
|
|
68
|
-
# expect(chef_run).to_not remove_rpm_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_rpm_package(resource_name)
|
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:rpm_package, :remove, resource_name)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
#
|
|
81
|
-
# Assert that a +rpm_package+ resource exists in the Chef run with the
|
|
82
|
-
# action +:upgrade+. Given a Chef Recipe that upgrades "apache2" as a
|
|
83
|
-
# +rpm_package+:
|
|
84
|
-
#
|
|
85
|
-
# rpm_package 'apache2' do
|
|
86
|
-
# action :upgrade
|
|
87
|
-
# end
|
|
88
|
-
#
|
|
89
|
-
# The Examples section demonstrates the different ways to test a
|
|
90
|
-
# +rpm_package+ resource with ChefSpec.
|
|
91
|
-
#
|
|
92
|
-
# @example Assert that a +rpm_package+ was upgraded
|
|
93
|
-
# expect(chef_run).to upgrade_rpm_package('apache2')
|
|
94
|
-
#
|
|
95
|
-
# @example Assert that a +rpm_package+ was upgraded with predicate matchers
|
|
96
|
-
# expect(chef_run).to upgrade_rpm_package('apache2').with_version('1.2.3')
|
|
97
|
-
#
|
|
98
|
-
# @example Assert that a +rpm_package+ was upgraded with attributes
|
|
99
|
-
# expect(chef_run).to upgrade_rpm_package('apache2').with(version: '1.2.3')
|
|
100
|
-
#
|
|
101
|
-
# @example Assert that a +rpm_package+ was upgraded using a regex
|
|
102
|
-
# expect(chef_run).to upgrade_rpm_package('apache2').with(version: /(\d+\.){2}\.\d+/)
|
|
103
|
-
#
|
|
104
|
-
# @example Assert that a +rpm_package+ was _not_ upgraded
|
|
105
|
-
# expect(chef_run).to_not upgrade_rpm_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_rpm_package(resource_name)
|
|
114
|
-
ChefSpec::Matchers::ResourceMatcher.new(:rpm_package, :upgrade, resource_name)
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
module ChefSpec::API
|
|
2
|
-
# @since 0.5.0
|
|
3
|
-
module RubyBlockMatchers
|
|
4
|
-
ChefSpec.define_matcher :ruby_block
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
# Assert that a +ruby_block+ resource exists in the Chef run with the
|
|
8
|
-
# action +:run+. Given a Chef Recipe that runs "do_something" as a
|
|
9
|
-
# +ruby_block+:
|
|
10
|
-
#
|
|
11
|
-
# ruby_block 'do_something' do
|
|
12
|
-
# block do
|
|
13
|
-
# # ...
|
|
14
|
-
# end
|
|
15
|
-
# action :run
|
|
16
|
-
# end
|
|
17
|
-
#
|
|
18
|
-
# The Examples section demonstrates the different ways to test a
|
|
19
|
-
# +ruby_block+ resource with ChefSpec.
|
|
20
|
-
#
|
|
21
|
-
# @example Assert that a +ruby_block+ was run
|
|
22
|
-
# expect(chef_run).to run_ruby_block('do_something')
|
|
23
|
-
#
|
|
24
|
-
# @example Assert that a +ruby_block+ was _not_ run
|
|
25
|
-
# expect(chef_run).to_not run_ruby_block('do_something')
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# @param [String, Regex] resource_name
|
|
29
|
-
# the name of the resource to match
|
|
30
|
-
#
|
|
31
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
32
|
-
#
|
|
33
|
-
def run_ruby_block(resource_name)
|
|
34
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ruby_block, :run, resource_name)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
#
|
|
38
|
-
# Assert that a +ruby_block+ resource exists in the Chef run with the
|
|
39
|
-
# action +:create+. Given a Chef Recipe that runs "do_something" as a
|
|
40
|
-
# +ruby_block+:
|
|
41
|
-
#
|
|
42
|
-
# ruby_block 'do_something' do
|
|
43
|
-
# block do
|
|
44
|
-
# # ...
|
|
45
|
-
# end
|
|
46
|
-
# action :create
|
|
47
|
-
# end
|
|
48
|
-
#
|
|
49
|
-
# The Examples section demonstrates the different ways to test a
|
|
50
|
-
# +ruby_block+ resource with ChefSpec.
|
|
51
|
-
#
|
|
52
|
-
# @example Assert that a +ruby_block+ was run
|
|
53
|
-
# expect(chef_run).to create_ruby_block('do_something')
|
|
54
|
-
#
|
|
55
|
-
# @example Assert that a +ruby_block+ was _not_ run
|
|
56
|
-
# expect(chef_run).to_not create_ruby_block('do_something')
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
# @param [String, Regex] resource_name
|
|
60
|
-
# the name of the resource to match
|
|
61
|
-
#
|
|
62
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
63
|
-
#
|
|
64
|
-
def create_ruby_block(resource_name)
|
|
65
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ruby_block, :create, resource_name)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
data/lib/chefspec/api/script.rb
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
module ChefSpec::API
|
|
2
|
-
# @since 1.0.0
|
|
3
|
-
module ScriptMatchers
|
|
4
|
-
#
|
|
5
|
-
# Assert that a +ksh+ resource exists in the Chef run with the
|
|
6
|
-
# action +:run+. Given a Chef Recipe that runs "command" using
|
|
7
|
-
# +ksh+:
|
|
8
|
-
#
|
|
9
|
-
# ksh 'command' do
|
|
10
|
-
# action :run
|
|
11
|
-
# end
|
|
12
|
-
#
|
|
13
|
-
# The Examples section demonstrates the different ways to test a
|
|
14
|
-
# +ksh+ resource with ChefSpec.
|
|
15
|
-
#
|
|
16
|
-
# @example Assert that a +ksh+ was run
|
|
17
|
-
# expect(chef_run).to run_ksh('command')
|
|
18
|
-
#
|
|
19
|
-
# @example Assert that a +ksh+ was run with predicate matchers
|
|
20
|
-
# expect(chef_run).to run_ksh('command').with_cwd('/home')
|
|
21
|
-
#
|
|
22
|
-
# @example Assert that a +ksh+ was run with attributes
|
|
23
|
-
# expect(chef_run).to run_ksh('command').with(cwd: '/home')
|
|
24
|
-
#
|
|
25
|
-
# @example Assert that a +ksh+ was run using a regex
|
|
26
|
-
# expect(chef_run).to run_ksh('command').with(cwd: /\/(.+)/)
|
|
27
|
-
#
|
|
28
|
-
# @example Assert that a +ksh+ was _not_ run
|
|
29
|
-
# expect(chef_run).to_not run_ksh('command')
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
# @param [String, Regex] resource_name
|
|
33
|
-
# the name of the resource to match
|
|
34
|
-
#
|
|
35
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
36
|
-
#
|
|
37
|
-
def run_ksh(resource_name)
|
|
38
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ksh, :run, resource_name)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
ChefSpec.define_matcher :ksh
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
# Assert that a +bash+ resource exists in the Chef run with the
|
|
45
|
-
# action +:run+. Given a Chef Recipe that runs "command" using
|
|
46
|
-
# +bash+:
|
|
47
|
-
#
|
|
48
|
-
# bash 'command' do
|
|
49
|
-
# action :run
|
|
50
|
-
# end
|
|
51
|
-
#
|
|
52
|
-
# The Examples section demonstrates the different ways to test a
|
|
53
|
-
# +bash+ resource with ChefSpec.
|
|
54
|
-
#
|
|
55
|
-
# @example Assert that a +bash+ was run
|
|
56
|
-
# expect(chef_run).to run_bash('command')
|
|
57
|
-
#
|
|
58
|
-
# @example Assert that a +bash+ was run with predicate matchers
|
|
59
|
-
# expect(chef_run).to run_bash('command').with_cwd('/home')
|
|
60
|
-
#
|
|
61
|
-
# @example Assert that a +bash+ was run with attributes
|
|
62
|
-
# expect(chef_run).to run_bash('command').with(cwd: '/home')
|
|
63
|
-
#
|
|
64
|
-
# @example Assert that a +bash+ was run using a regex
|
|
65
|
-
# expect(chef_run).to run_bash('command').with(cwd: /\/(.+)/)
|
|
66
|
-
#
|
|
67
|
-
# @example Assert that a +bash+ was _not_ run
|
|
68
|
-
# expect(chef_run).to_not run_bash('command')
|
|
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 run_bash(resource_name)
|
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:bash, :run, resource_name)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
ChefSpec.define_matcher :bash
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
# Assert that a +csh+ resource exists in the Chef run with the
|
|
84
|
-
# action +:run+. Given a Chef Recipe that runs "command" using
|
|
85
|
-
# +csh+:
|
|
86
|
-
#
|
|
87
|
-
# csh 'command' do
|
|
88
|
-
# action :run
|
|
89
|
-
# end
|
|
90
|
-
#
|
|
91
|
-
# The Examples section demonstrates the different ways to test a
|
|
92
|
-
# +csh+ resource with ChefSpec.
|
|
93
|
-
#
|
|
94
|
-
# @example Assert that a +csh+ was run
|
|
95
|
-
# expect(chef_run).to run_csh('command')
|
|
96
|
-
#
|
|
97
|
-
# @example Assert that a +csh+ was run with predicate matchers
|
|
98
|
-
# expect(chef_run).to run_csh('command').with_cwd('/home')
|
|
99
|
-
#
|
|
100
|
-
# @example Assert that a +csh+ was run with attributes
|
|
101
|
-
# expect(chef_run).to run_csh('command').with(cwd: '/home')
|
|
102
|
-
#
|
|
103
|
-
# @example Assert that a +csh+ was run using a regex
|
|
104
|
-
# expect(chef_run).to run_csh('command').with(cwd: /\/(.+)/)
|
|
105
|
-
#
|
|
106
|
-
# @example Assert that a +csh+ was _not_ run
|
|
107
|
-
# expect(chef_run).to_not run_csh('command')
|
|
108
|
-
#
|
|
109
|
-
#
|
|
110
|
-
# @param [String, Regex] resource_name
|
|
111
|
-
# the name of the resource to match
|
|
112
|
-
#
|
|
113
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
114
|
-
#
|
|
115
|
-
def run_csh(resource_name)
|
|
116
|
-
ChefSpec::Matchers::ResourceMatcher.new(:csh, :run, resource_name)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
ChefSpec.define_matcher :csh
|
|
120
|
-
|
|
121
|
-
#
|
|
122
|
-
# Assert that a +perl+ resource exists in the Chef run with the
|
|
123
|
-
# action +:run+. Given a Chef Recipe that runs "command" using
|
|
124
|
-
# +perl+:
|
|
125
|
-
#
|
|
126
|
-
# perl 'command' do
|
|
127
|
-
# action :run
|
|
128
|
-
# end
|
|
129
|
-
#
|
|
130
|
-
# The Examples section demonstrates the different ways to test a
|
|
131
|
-
# +perl+ resource with ChefSpec.
|
|
132
|
-
#
|
|
133
|
-
# @example Assert that a +perl+ was run
|
|
134
|
-
# expect(chef_run).to run_perl('command')
|
|
135
|
-
#
|
|
136
|
-
# @example Assert that a +perl+ was run with predicate matchers
|
|
137
|
-
# expect(chef_run).to run_perl('command').with_cwd('/home')
|
|
138
|
-
#
|
|
139
|
-
# @example Assert that a +perl+ was run with attributes
|
|
140
|
-
# expect(chef_run).to run_perl('command').with(cwd: '/home')
|
|
141
|
-
#
|
|
142
|
-
# @example Assert that a +perl+ was run using a regex
|
|
143
|
-
# expect(chef_run).to run_perl('command').with(cwd: /\/(.+)/)
|
|
144
|
-
#
|
|
145
|
-
# @example Assert that a +perl+ was _not_ run
|
|
146
|
-
# expect(chef_run).to_not run_perl('command')
|
|
147
|
-
#
|
|
148
|
-
#
|
|
149
|
-
# @param [String, Regex] resource_name
|
|
150
|
-
# the name of the resource to match
|
|
151
|
-
#
|
|
152
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
153
|
-
#
|
|
154
|
-
def run_perl(resource_name)
|
|
155
|
-
ChefSpec::Matchers::ResourceMatcher.new(:perl, :run, resource_name)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
ChefSpec.define_matcher :perl
|
|
159
|
-
|
|
160
|
-
#
|
|
161
|
-
# Assert that a +python+ resource exists in the Chef run with the
|
|
162
|
-
# action +:run+. Given a Chef Recipe that runs "command" using
|
|
163
|
-
# +python+:
|
|
164
|
-
#
|
|
165
|
-
# python 'command' do
|
|
166
|
-
# action :run
|
|
167
|
-
# end
|
|
168
|
-
#
|
|
169
|
-
# The Examples section demonstrates the different ways to test a
|
|
170
|
-
# +python+ resource with ChefSpec.
|
|
171
|
-
#
|
|
172
|
-
# @example Assert that a +python+ was run
|
|
173
|
-
# expect(chef_run).to run_python('command')
|
|
174
|
-
#
|
|
175
|
-
# @example Assert that a +python+ was run with predicate matchers
|
|
176
|
-
# expect(chef_run).to run_python('command').with_cwd('/home')
|
|
177
|
-
#
|
|
178
|
-
# @example Assert that a +python+ was run with attributes
|
|
179
|
-
# expect(chef_run).to run_python('command').with(cwd: '/home')
|
|
180
|
-
#
|
|
181
|
-
# @example Assert that a +python+ was run using a regex
|
|
182
|
-
# expect(chef_run).to run_python('command').with(cwd: /\/(.+)/)
|
|
183
|
-
#
|
|
184
|
-
# @example Assert that a +python+ was _not_ run
|
|
185
|
-
# expect(chef_run).to_not run_python('command')
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
# @param [String, Regex] resource_name
|
|
189
|
-
# the name of the resource to match
|
|
190
|
-
#
|
|
191
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
192
|
-
#
|
|
193
|
-
def run_python(resource_name)
|
|
194
|
-
ChefSpec::Matchers::ResourceMatcher.new(:python, :run, resource_name)
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
ChefSpec.define_matcher :python
|
|
198
|
-
|
|
199
|
-
#
|
|
200
|
-
# Assert that a +ruby+ resource exists in the Chef run with the
|
|
201
|
-
# action +:run+. Given a Chef Recipe that runs "command" using
|
|
202
|
-
# +ruby+:
|
|
203
|
-
#
|
|
204
|
-
# ruby 'command' do
|
|
205
|
-
# action :run
|
|
206
|
-
# end
|
|
207
|
-
#
|
|
208
|
-
# The Examples section demonstrates the different ways to test a
|
|
209
|
-
# +ruby+ resource with ChefSpec.
|
|
210
|
-
#
|
|
211
|
-
# @example Assert that a +ruby+ was run
|
|
212
|
-
# expect(chef_run).to run_ruby('command')
|
|
213
|
-
#
|
|
214
|
-
# @example Assert that a +ruby+ was run with predicate matchers
|
|
215
|
-
# expect(chef_run).to run_ruby('command').with_cwd('/home')
|
|
216
|
-
#
|
|
217
|
-
# @example Assert that a +ruby+ was run with attributes
|
|
218
|
-
# expect(chef_run).to run_ruby('command').with(cwd: '/home')
|
|
219
|
-
#
|
|
220
|
-
# @example Assert that a +ruby+ was run using a regex
|
|
221
|
-
# expect(chef_run).to run_ruby('command').with(cwd: /\/(.+)/)
|
|
222
|
-
#
|
|
223
|
-
# @example Assert that a +ruby+ was _not_ run
|
|
224
|
-
# expect(chef_run).to_not run_ruby('command')
|
|
225
|
-
#
|
|
226
|
-
#
|
|
227
|
-
# @param [String, Regex] resource_name
|
|
228
|
-
# the name of the resource to match
|
|
229
|
-
#
|
|
230
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
231
|
-
#
|
|
232
|
-
def run_ruby(resource_name)
|
|
233
|
-
ChefSpec::Matchers::ResourceMatcher.new(:ruby, :run, resource_name)
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
ChefSpec.define_matcher :ruby
|
|
237
|
-
|
|
238
|
-
#
|
|
239
|
-
# Assert that a +script+ resource exists in the Chef run with the
|
|
240
|
-
# action +:run+. Given a Chef Recipe that runs "command" using
|
|
241
|
-
# +script+:
|
|
242
|
-
#
|
|
243
|
-
# script 'command' do
|
|
244
|
-
# action :run
|
|
245
|
-
# end
|
|
246
|
-
#
|
|
247
|
-
# The Examples section demonstrates the different ways to test a
|
|
248
|
-
# +script+ resource with ChefSpec.
|
|
249
|
-
#
|
|
250
|
-
# @example Assert that a +script+ was run
|
|
251
|
-
# expect(chef_run).to run_script('command')
|
|
252
|
-
#
|
|
253
|
-
# @example Assert that a +script+ was run with predicate matchers
|
|
254
|
-
# expect(chef_run).to run_script('command').with_cwd('/home')
|
|
255
|
-
#
|
|
256
|
-
# @example Assert that a +script+ was run with attributes
|
|
257
|
-
# expect(chef_run).to run_script('command').with(cwd: '/home')
|
|
258
|
-
#
|
|
259
|
-
# @example Assert that a +script+ was run using a regex
|
|
260
|
-
# expect(chef_run).to run_script('command').with(cwd: /\/(.+)/)
|
|
261
|
-
#
|
|
262
|
-
# @example Assert that a +script+ was _not_ run
|
|
263
|
-
# expect(chef_run).to_not run_script('command')
|
|
264
|
-
#
|
|
265
|
-
#
|
|
266
|
-
# @param [String, Regex] resource_name
|
|
267
|
-
# the name of the resource to match
|
|
268
|
-
#
|
|
269
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
|
270
|
-
#
|
|
271
|
-
def run_script(resource_name)
|
|
272
|
-
ChefSpec::Matchers::ResourceMatcher.new(:script, :run, resource_name)
|
|
273
|
-
end
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
ChefSpec.define_matcher :script
|
|
277
|
-
end
|
|
278
|
-
end
|