chef 14.1.12 → 14.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -6
- data/VERSION +1 -1
- data/chef.gemspec +2 -3
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +8 -4
- data/lib/chef/cookbook/manifest_v0.rb +2 -2
- data/lib/chef/cookbook_manifest.rb +3 -2
- data/lib/chef/cookbook_version.rb +3 -2
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -2
- data/lib/chef/http/auth_credentials.rb +5 -3
- data/lib/chef/http/authenticator.rb +6 -3
- data/lib/chef/knife.rb +3 -6
- data/lib/chef/knife/configure.rb +12 -8
- data/lib/chef/knife/raw.rb +6 -1
- data/lib/chef/mixin/shell_out.rb +16 -14
- data/lib/chef/provider/execute.rb +4 -3
- data/lib/chef/provider/git.rb +1 -1
- data/lib/chef/provider/package/dnf.rb +5 -5
- data/lib/chef/provider/package/windows.rb +7 -0
- data/lib/chef/provider/package/yum.rb +7 -7
- data/lib/chef/provider/service/freebsd.rb +3 -3
- data/lib/chef/provider/service/init.rb +5 -5
- data/lib/chef/provider/service/macosx.rb +5 -4
- data/lib/chef/provider/service/simple.rb +4 -4
- data/lib/chef/provider/service/systemd.rb +13 -13
- data/lib/chef/provider/service/upstart.rb +3 -3
- data/lib/chef/provider/service/windows.rb +2 -0
- data/lib/chef/provider/systemd_unit.rb +4 -4
- data/lib/chef/provider/user.rb +18 -1
- data/lib/chef/provider/user/aix.rb +40 -8
- data/lib/chef/provider/user/dscl.rb +7 -14
- data/lib/chef/provider/user/linux.rb +1 -11
- data/lib/chef/provider/user/solaris.rb +57 -26
- data/lib/chef/provider/user/useradd.rb +4 -1
- data/lib/chef/provider/windows_task.rb +1 -0
- data/lib/chef/providers.rb +1 -2
- data/lib/chef/resource/execute.rb +4 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/hostname.rb +1 -1
- data/lib/chef/resource/sysctl.rb +3 -1
- data/lib/chef/resource/windows_ad_join.rb +16 -3
- data/lib/chef/resource_inspector.rb +13 -0
- data/lib/chef/run_context/cookbook_compiler.rb +1 -1
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/version.rb +1 -1
- data/spec/functional/mixin/shell_out_spec.rb +27 -1
- data/spec/functional/resource/execute_spec.rb +2 -2
- data/spec/functional/resource/windows_task_spec.rb +1 -1
- data/spec/support/shared/functional/securable_resource.rb +1 -1
- data/spec/support/shared/unit/execute_resource.rb +1 -1
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +3 -3
- data/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +65 -0
- data/spec/unit/cookbook/manifest_v0_spec.rb +1 -1
- data/spec/unit/cookbook_manifest_spec.rb +2 -0
- data/spec/unit/dsl/recipe_spec.rb +1 -5
- data/spec/unit/http/authenticator_spec.rb +33 -8
- data/spec/unit/mixin/shell_out_spec.rb +61 -1
- data/spec/unit/provider/apt_update_spec.rb +7 -7
- data/spec/unit/provider/execute_spec.rb +16 -15
- data/spec/unit/provider/git_spec.rb +3 -3
- data/spec/unit/provider/package/windows_spec.rb +12 -0
- data/spec/unit/provider/script_spec.rb +2 -2
- data/spec/unit/provider/service/arch_service_spec.rb +9 -9
- data/spec/unit/provider/service/freebsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/init_service_spec.rb +11 -11
- data/spec/unit/provider/service/invokercd_service_spec.rb +9 -9
- data/spec/unit/provider/service/macosx_spec.rb +11 -11
- data/spec/unit/provider/service/openbsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/simple_service_spec.rb +4 -4
- data/spec/unit/provider/service/systemd_service_spec.rb +16 -16
- data/spec/unit/provider/service/upstart_service_spec.rb +12 -12
- data/spec/unit/provider/service/windows_spec.rb +5 -0
- data/spec/unit/provider/systemd_unit_spec.rb +163 -118
- data/spec/unit/provider/user/dscl_spec.rb +2 -9
- data/spec/unit/provider/user/solaris_spec.rb +2 -2
- data/spec/unit/provider/zypper_repository_spec.rb +3 -3
- data/spec/unit/provider_spec.rb +1 -5
- data/spec/unit/resource/apt_package_spec.rb +14 -0
- data/spec/unit/resource/apt_preference_spec.rb +14 -1
- data/spec/unit/resource/apt_repository_spec.rb +12 -3
- data/spec/unit/resource/apt_update_spec.rb +9 -0
- data/spec/unit/resource/bash_spec.rb +8 -0
- data/spec/unit/resource/bff_package_spec.rb +51 -0
- data/spec/unit/resource/breakpoint_spec.rb +4 -4
- data/spec/unit/resource/build_essential_spec.rb +5 -1
- data/spec/unit/resource/cab_package_spec.rb +10 -0
- data/spec/unit/resource/chef_gem_spec.rb +14 -0
- data/spec/unit/resource/chef_handler_spec.rb +9 -4
- data/spec/unit/resource/chocolatey_package_spec.rb +15 -1
- data/spec/unit/resource/conditional_spec.rb +3 -3
- data/spec/unit/resource/cookbook_file_spec.rb +13 -2
- data/spec/unit/resource/cron_spec.rb +2 -7
- data/spec/unit/resource/csh_spec.rb +8 -0
- data/spec/unit/resource/directory_spec.rb +4 -9
- data/spec/unit/resource/dmg_package_spec.rb +8 -4
- data/spec/unit/resource/dnf_package_spec.rb +16 -1
- data/spec/unit/resource/dpkg_package_spec.rb +18 -0
- data/spec/unit/resource/dsc_resource_spec.rb +6 -6
- data/spec/unit/resource/dsc_script_spec.rb +39 -39
- data/spec/unit/resource/execute_spec.rb +20 -12
- data/spec/unit/resource/file_spec.rb +10 -10
- data/spec/unit/resource/freebsd_package_spec.rb +16 -0
- data/spec/unit/resource/gem_package_spec.rb +27 -0
- data/spec/unit/resource/git_spec.rb +17 -2
- data/spec/unit/resource/group_spec.rb +18 -17
- data/spec/unit/resource/homebrew_cask_spec.rb +9 -4
- data/spec/unit/resource/homebrew_package_spec.rb +14 -0
- data/spec/unit/resource/homebrew_tap_spec.rb +8 -3
- data/spec/unit/resource/hostname_spec.rb +10 -6
- data/spec/unit/resource/http_request_spec.rb +14 -0
- data/spec/unit/resource/ips_package_spec.rb +15 -3
- data/spec/unit/resource/ksh_spec.rb +8 -0
- data/spec/unit/resource/launchd_spec.rb +11 -5
- data/spec/unit/resource/link_spec.rb +6 -11
- data/spec/unit/resource/log_spec.rb +8 -8
- data/spec/unit/resource/macos_user_defaults_spec.rb +5 -1
- data/spec/unit/resource/macports_package_spec.rb +19 -0
- data/spec/unit/resource/mdadm_spec.rb +7 -3
- data/spec/unit/resource/mount_spec.rb +15 -18
- data/spec/unit/resource/msu_package_spec.rb +10 -0
- data/spec/unit/resource/ohai_hint_spec.rb +9 -8
- data/spec/unit/resource/ohai_spec.rb +11 -3
- data/spec/unit/resource/openbsd_package_spec.rb +14 -0
- data/spec/unit/resource/openssl_dhparam.rb +10 -5
- data/spec/unit/resource/openssl_rsa_private_key_spec.rb +10 -5
- data/spec/unit/resource/openssl_rsa_public_key_spec.rb +9 -5
- data/spec/unit/resource/osx_profile_spec.rb +7 -4
- data/spec/unit/resource/package_spec.rb +14 -0
- data/spec/unit/resource/pacman_package_spec.rb +17 -3
- data/spec/unit/resource/paludis_package_spec.rb +36 -0
- data/spec/unit/resource/perl_spec.rb +8 -0
- data/spec/unit/resource/portage_package_spec.rb +14 -0
- data/spec/unit/resource/powershell_package_spec.rb +14 -0
- data/spec/unit/resource/python_spec.rb +8 -0
- data/spec/unit/resource/reboot_spec.rb +5 -3
- data/spec/unit/resource/registry_key_spec.rb +12 -1
- data/spec/unit/resource/remote_directory_spec.rb +11 -1
- data/spec/unit/resource/remote_file_spec.rb +19 -0
- data/spec/unit/resource/rhsm_errata_level_spec.rb +7 -3
- data/spec/unit/resource/rhsm_errata_spec.rb +8 -4
- data/spec/unit/resource/rhsm_register_spec.rb +6 -1
- data/spec/unit/resource/rhsm_repo_spec.rb +9 -4
- data/spec/unit/resource/rhsm_subscription_spec.rb +9 -4
- data/spec/unit/resource/route_spec.rb +4 -9
- data/spec/unit/resource/rpm_package_spec.rb +14 -0
- data/spec/unit/resource/ruby_block_spec.rb +12 -8
- data/spec/unit/resource/ruby_spec.rb +8 -0
- data/spec/unit/resource/scm_spec.rb +16 -8
- data/spec/unit/resource/script_spec.rb +8 -0
- data/spec/unit/resource/service_spec.rb +15 -0
- data/spec/unit/resource/smartos_package_spec.rb +18 -4
- data/spec/unit/resource/solaris_package_spec.rb +14 -0
- data/spec/unit/resource/subversion_spec.rb +14 -8
- data/spec/unit/resource/sudo_spec.rb +11 -4
- data/spec/unit/resource/swap_file_spec.rb +4 -5
- data/spec/unit/resource/sysctl_spec.rb +8 -10
- data/spec/unit/resource/systemd_unit_spec.rb +14 -12
- data/spec/unit/resource/template_spec.rb +19 -0
- data/spec/unit/resource/{windows_ad_join.rb → windows_ad_join_spec.rb} +12 -6
- data/spec/unit/resource/windows_auto_run_spec.rb +9 -9
- data/spec/unit/resource/windows_env_spec.rb +8 -16
- data/spec/unit/resource/windows_feature.rb +27 -8
- data/spec/unit/resource/windows_feature_dism.rb +30 -9
- data/spec/unit/resource/windows_feature_powershell.rb +7 -7
- data/spec/unit/resource/windows_font_spec.rb +3 -4
- data/spec/unit/resource/windows_package_spec.rb +12 -2
- data/spec/unit/resource/windows_pagefile_spec.rb +12 -8
- data/spec/unit/resource/windows_path_spec.rb +4 -5
- data/spec/unit/resource/windows_printer_port_spec.rb +20 -3
- data/spec/unit/resource/windows_printer_spec.rb +12 -5
- data/spec/unit/resource/windows_service_spec.rb +24 -1
- data/spec/unit/resource/windows_shortcut_spec.rb +4 -5
- data/spec/unit/resource/yum_repository_spec.rb +48 -2
- data/spec/unit/resource/zypper_package_spec.rb +51 -0
- data/spec/unit/resource/zypper_repository_spec.rb +56 -11
- data/spec/unit/resource_spec.rb +1 -5
- metadata +21 -12
- data/spec/functional/resource/user/useradd_spec.rb +0 -709
@@ -33,8 +33,35 @@ end
|
|
33
33
|
describe Chef::Resource::GemPackage, "gem_binary" do
|
34
34
|
let(:resource) { Chef::Resource::GemPackage.new("foo") }
|
35
35
|
|
36
|
+
it "sets the default action as :install" do
|
37
|
+
expect(resource.action).to eql([:install])
|
38
|
+
end
|
39
|
+
|
40
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
41
|
+
expect { resource.action :install }.not_to raise_error
|
42
|
+
expect { resource.action :lock }.not_to raise_error
|
43
|
+
expect { resource.action :purge }.not_to raise_error
|
44
|
+
expect { resource.action :reconfig }.not_to raise_error
|
45
|
+
expect { resource.action :remove }.not_to raise_error
|
46
|
+
expect { resource.action :unlock }.not_to raise_error
|
47
|
+
expect { resource.action :upgrade }.not_to raise_error
|
48
|
+
end
|
49
|
+
|
36
50
|
it "sets the gem_binary variable to whatever is passed in" do
|
37
51
|
resource.gem_binary("/opt/local/bin/gem")
|
38
52
|
expect(resource.gem_binary).to eql("/opt/local/bin/gem")
|
39
53
|
end
|
40
54
|
end
|
55
|
+
|
56
|
+
describe Chef::Resource::GemPackage, "clear_gem_sources" do
|
57
|
+
let(:resource) { Chef::Resource::GemPackage.new("foo") }
|
58
|
+
|
59
|
+
it "is false by default" do
|
60
|
+
expect(resource.clear_sources).to be false
|
61
|
+
end
|
62
|
+
|
63
|
+
it "sets the default of clear_sources to the config value" do
|
64
|
+
Chef::Config[:clear_gem_sources] = true
|
65
|
+
expect(resource.clear_sources).to be true
|
66
|
+
end
|
67
|
+
end
|
@@ -17,7 +17,6 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "spec_helper"
|
20
|
-
require "support/shared/unit/resource/static_provider_resolution"
|
21
20
|
|
22
21
|
describe Chef::Resource::Git do
|
23
22
|
|
@@ -28,7 +27,7 @@ describe Chef::Resource::Git do
|
|
28
27
|
action: :sync
|
29
28
|
)
|
30
29
|
|
31
|
-
let(:resource) { Chef::Resource::Git.new("
|
30
|
+
let(:resource) { Chef::Resource::Git.new("fakey_fakerton") }
|
32
31
|
|
33
32
|
it "is a subclass of Chef::Resource::Scm" do
|
34
33
|
expect(resource).to be_a_kind_of(Chef::Resource::Scm)
|
@@ -44,4 +43,20 @@ describe Chef::Resource::Git do
|
|
44
43
|
expect(resource.revision).to eql("v1.0 tag")
|
45
44
|
end
|
46
45
|
|
46
|
+
it "the destination property is the name_property" do
|
47
|
+
expect(resource.destination).to eql("fakey_fakerton")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "sets the default action as :sync" do
|
51
|
+
expect(resource.action).to eql([:sync])
|
52
|
+
end
|
53
|
+
|
54
|
+
it "supports :checkout, :diff, :export, :log, :sync actions" do
|
55
|
+
expect { resource.action :checkout }.not_to raise_error
|
56
|
+
expect { resource.action :diff }.not_to raise_error
|
57
|
+
expect { resource.action :export }.not_to raise_error
|
58
|
+
expect { resource.action :log }.not_to raise_error
|
59
|
+
expect { resource.action :sync }.not_to raise_error
|
60
|
+
end
|
61
|
+
|
47
62
|
end
|
@@ -20,14 +20,25 @@
|
|
20
20
|
require "spec_helper"
|
21
21
|
|
22
22
|
describe Chef::Resource::Group, "initialize" do
|
23
|
-
let(:resource) { Chef::Resource::Group.new("
|
23
|
+
let(:resource) { Chef::Resource::Group.new("fakey_fakerton") }
|
24
24
|
|
25
25
|
it "sets the resource_name to :group" do
|
26
26
|
expect(resource.resource_name).to eql(:group)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
30
|
-
expect(resource.group_name).to eql("
|
29
|
+
it "the group_name property is the name_property" do
|
30
|
+
expect(resource.group_name).to eql("fakey_fakerton")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "sets the default action as :create" do
|
34
|
+
expect(resource.action).to eql([:create])
|
35
|
+
end
|
36
|
+
|
37
|
+
it "supports :create, :manage, :modify, :remove actions" do
|
38
|
+
expect { resource.action :create }.not_to raise_error
|
39
|
+
expect { resource.action :manage }.not_to raise_error
|
40
|
+
expect { resource.action :modify }.not_to raise_error
|
41
|
+
expect { resource.action :remove }.not_to raise_error
|
31
42
|
end
|
32
43
|
|
33
44
|
it "defaults gid to nil" do
|
@@ -42,16 +53,6 @@ describe Chef::Resource::Group, "initialize" do
|
|
42
53
|
expect(resource.users).to eql([])
|
43
54
|
end
|
44
55
|
|
45
|
-
it "sets action to :create" do
|
46
|
-
expect(resource.action).to eql([:create])
|
47
|
-
end
|
48
|
-
|
49
|
-
%w{create remove modify manage}.each do |action|
|
50
|
-
it "allows action #{action}" do
|
51
|
-
expect(resource.allowed_actions.detect { |a| a == action.to_sym }).to eql(action.to_sym)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
56
|
it "accepts domain groups (@ or \ separator) on non-windows" do
|
56
57
|
expect { resource.group_name "domain\@group" }.not_to raise_error
|
57
58
|
expect(resource.group_name).to eq("domain\@group")
|
@@ -63,7 +64,7 @@ describe Chef::Resource::Group, "initialize" do
|
|
63
64
|
end
|
64
65
|
|
65
66
|
describe Chef::Resource::Group, "group_name" do
|
66
|
-
let(:resource) { Chef::Resource::Group.new("
|
67
|
+
let(:resource) { Chef::Resource::Group.new("fakey_fakerton") }
|
67
68
|
|
68
69
|
it "allows a string" do
|
69
70
|
resource.group_name "pirates"
|
@@ -76,7 +77,7 @@ describe Chef::Resource::Group, "group_name" do
|
|
76
77
|
end
|
77
78
|
|
78
79
|
describe Chef::Resource::Group, "gid" do
|
79
|
-
let(:resource) { Chef::Resource::Group.new("
|
80
|
+
let(:resource) { Chef::Resource::Group.new("fakey_fakerton") }
|
80
81
|
|
81
82
|
it "allows an integer" do
|
82
83
|
resource.gid 100
|
@@ -89,7 +90,7 @@ describe Chef::Resource::Group, "gid" do
|
|
89
90
|
end
|
90
91
|
|
91
92
|
describe Chef::Resource::Group, "members" do
|
92
|
-
let(:resource) { Chef::Resource::Group.new("
|
93
|
+
let(:resource) { Chef::Resource::Group.new("fakey_fakerton") }
|
93
94
|
|
94
95
|
[ :users, :members].each do |method|
|
95
96
|
it "(#{method}) allows and convert a string" do
|
@@ -114,7 +115,7 @@ describe Chef::Resource::Group, "members" do
|
|
114
115
|
end
|
115
116
|
|
116
117
|
describe Chef::Resource::Group, "append" do
|
117
|
-
let(:resource) { Chef::Resource::Group.new("
|
118
|
+
let(:resource) { Chef::Resource::Group.new("fakey_fakerton") }
|
118
119
|
|
119
120
|
it "defaults to false" do
|
120
121
|
expect(resource.append).to eql(false)
|
@@ -19,17 +19,22 @@ require "spec_helper"
|
|
19
19
|
|
20
20
|
describe Chef::Resource::HomebrewCask do
|
21
21
|
|
22
|
-
let(:resource) { Chef::Resource::HomebrewCask.new("
|
22
|
+
let(:resource) { Chef::Resource::HomebrewCask.new("fakey_fakerton") }
|
23
23
|
|
24
24
|
it "has a resource name of :homebrew_cask" do
|
25
25
|
expect(resource.resource_name).to eql(:homebrew_cask)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "the cask_name property is the name_property" do
|
29
|
+
expect(resource.cask_name).to eql("fakey_fakerton")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "sets the default action as :install" do
|
29
33
|
expect(resource.action).to eql([:install])
|
30
34
|
end
|
31
35
|
|
32
|
-
it "
|
33
|
-
expect
|
36
|
+
it "supports :install, :remove actions" do
|
37
|
+
expect { resource.action :install }.not_to raise_error
|
38
|
+
expect { resource.action :remove }.not_to raise_error
|
34
39
|
end
|
35
40
|
end
|
@@ -34,6 +34,20 @@ describe Chef::Resource::HomebrewPackage, "initialize" do
|
|
34
34
|
expect(resource).to be_a_kind_of(Chef::Resource::Package)
|
35
35
|
end
|
36
36
|
|
37
|
+
it "sets the default action as :install" do
|
38
|
+
expect(resource.action).to eql([:install])
|
39
|
+
end
|
40
|
+
|
41
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
42
|
+
expect { resource.action :install }.not_to raise_error
|
43
|
+
expect { resource.action :lock }.not_to raise_error
|
44
|
+
expect { resource.action :purge }.not_to raise_error
|
45
|
+
expect { resource.action :reconfig }.not_to raise_error
|
46
|
+
expect { resource.action :remove }.not_to raise_error
|
47
|
+
expect { resource.action :unlock }.not_to raise_error
|
48
|
+
expect { resource.action :upgrade }.not_to raise_error
|
49
|
+
end
|
50
|
+
|
37
51
|
shared_examples "home_brew user set and returned" do
|
38
52
|
it "returns the configured homebrew_user" do
|
39
53
|
resource.homebrew_user user
|
@@ -25,12 +25,17 @@ describe Chef::Resource::HomebrewTap do
|
|
25
25
|
expect(resource.resource_name).to eql(:homebrew_tap)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "the tap_name property is the name_property" do
|
29
|
+
expect(resource.tap_name).to eql("user/mytap")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "sets the default action as :tap" do
|
29
33
|
expect(resource.action).to eql([:tap])
|
30
34
|
end
|
31
35
|
|
32
|
-
it "
|
33
|
-
expect
|
36
|
+
it "supports :tap, :untap actions" do
|
37
|
+
expect { resource.action :tap }.not_to raise_error
|
38
|
+
expect { resource.action :untap }.not_to raise_error
|
34
39
|
end
|
35
40
|
|
36
41
|
it "fails if tap_name isn't in the USER/TAP format" do
|
@@ -19,16 +19,24 @@ require "spec_helper"
|
|
19
19
|
|
20
20
|
describe Chef::Resource::Hostname do
|
21
21
|
|
22
|
-
let(:resource) { Chef::Resource::Hostname.new("
|
22
|
+
let(:resource) { Chef::Resource::Hostname.new("fakey_fakerton") }
|
23
23
|
|
24
24
|
it "has a resource name of :hostname" do
|
25
25
|
expect(resource.resource_name).to eql(:hostname)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "the hostname property is the name_property" do
|
29
|
+
expect(resource.hostname).to eql("fakey_fakerton")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "sets the default action as :set" do
|
29
33
|
expect(resource.action).to eql([:set])
|
30
34
|
end
|
31
35
|
|
36
|
+
it "supports :set action" do
|
37
|
+
expect { resource.action :set }.not_to raise_error
|
38
|
+
end
|
39
|
+
|
32
40
|
it "runs at compile_time by default" do
|
33
41
|
expect(resource.compile_time).to eql(true)
|
34
42
|
end
|
@@ -36,8 +44,4 @@ describe Chef::Resource::Hostname do
|
|
36
44
|
it "reboots windows nodes by default" do
|
37
45
|
expect(resource.windows_reboot).to eql(true)
|
38
46
|
end
|
39
|
-
|
40
|
-
it "the hostname property is the name property" do
|
41
|
-
expect(resource.hostname).to eql("foo")
|
42
|
-
end
|
43
47
|
end
|
@@ -22,6 +22,20 @@ require "spec_helper"
|
|
22
22
|
describe Chef::Resource::HttpRequest do
|
23
23
|
let(:resource) { Chef::Resource::HttpRequest.new("fakey_fakerton") }
|
24
24
|
|
25
|
+
it "sets the default action as :get" do
|
26
|
+
expect(resource.action).to eql([:get])
|
27
|
+
end
|
28
|
+
|
29
|
+
it "supports :delete, :get, :head, :options, :patch, :post, :put actions" do
|
30
|
+
expect { resource.action :delete }.not_to raise_error
|
31
|
+
expect { resource.action :get }.not_to raise_error
|
32
|
+
expect { resource.action :head }.not_to raise_error
|
33
|
+
expect { resource.action :options }.not_to raise_error
|
34
|
+
expect { resource.action :patch }.not_to raise_error
|
35
|
+
expect { resource.action :post }.not_to raise_error
|
36
|
+
expect { resource.action :put }.not_to raise_error
|
37
|
+
end
|
38
|
+
|
25
39
|
it "sets url to a string" do
|
26
40
|
resource.url "http://slashdot.org"
|
27
41
|
expect(resource.url).to eql("http://slashdot.org")
|
@@ -17,10 +17,8 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "spec_helper"
|
20
|
-
require "support/shared/unit/resource/static_provider_resolution"
|
21
|
-
|
22
|
-
describe Chef::Resource::IpsPackage, "initialize" do
|
23
20
|
|
21
|
+
describe Chef::Resource::IpsPackage do
|
24
22
|
static_provider_resolution(
|
25
23
|
resource: Chef::Resource::IpsPackage,
|
26
24
|
provider: Chef::Provider::Package::Ips,
|
@@ -39,4 +37,18 @@ describe Chef::Resource::IpsPackage, "initialize" do
|
|
39
37
|
resource.accept_license(true)
|
40
38
|
expect(resource.accept_license).to eql(true)
|
41
39
|
end
|
40
|
+
|
41
|
+
it "sets the default action as :install" do
|
42
|
+
expect(resource.action).to eql([:install])
|
43
|
+
end
|
44
|
+
|
45
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
46
|
+
expect { resource.action :install }.not_to raise_error
|
47
|
+
expect { resource.action :lock }.not_to raise_error
|
48
|
+
expect { resource.action :purge }.not_to raise_error
|
49
|
+
expect { resource.action :reconfig }.not_to raise_error
|
50
|
+
expect { resource.action :remove }.not_to raise_error
|
51
|
+
expect { resource.action :unlock }.not_to raise_error
|
52
|
+
expect { resource.action :upgrade }.not_to raise_error
|
53
|
+
end
|
42
54
|
end
|
@@ -30,6 +30,14 @@ describe Chef::Resource::Ksh do
|
|
30
30
|
expect(resource.resource_name).to eql(:ksh)
|
31
31
|
end
|
32
32
|
|
33
|
+
it "sets the default action as :run" do
|
34
|
+
expect(resource.action).to eql([:run])
|
35
|
+
end
|
36
|
+
|
37
|
+
it "supports :run action" do
|
38
|
+
expect { resource.action :run }.not_to raise_error
|
39
|
+
end
|
40
|
+
|
33
41
|
it "has an interpreter of ksh" do
|
34
42
|
expect(resource.interpreter).to eql("ksh")
|
35
43
|
end
|
@@ -15,20 +15,26 @@
|
|
15
15
|
require "spec_helper"
|
16
16
|
|
17
17
|
describe Chef::Resource::Launchd do
|
18
|
-
let(:resource) { Chef::Resource::Launchd.new("
|
18
|
+
let(:resource) { Chef::Resource::Launchd.new("fakey_fakerton" ) }
|
19
19
|
|
20
20
|
it "has a resource name of Launchd" do
|
21
21
|
expect(resource.resource_name).to eql(:launchd)
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "the label property is the name_property" do
|
25
|
+
expect(resource.label).to eql("fakey_fakerton")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "sets the default action as :create" do
|
25
29
|
expect(resource.action).to eql([:create])
|
26
30
|
end
|
27
31
|
|
28
|
-
it "
|
29
|
-
expect { resource.action :enable }.not_to raise_error
|
30
|
-
expect { resource.action :disable }.not_to raise_error
|
32
|
+
it "supports :create, :create_if_missing, :delete, :disable, :enable, :restart actions" do
|
31
33
|
expect { resource.action :create }.not_to raise_error
|
34
|
+
expect { resource.action :create_if_missing }.not_to raise_error
|
32
35
|
expect { resource.action :delete }.not_to raise_error
|
36
|
+
expect { resource.action :disable }.not_to raise_error
|
37
|
+
expect { resource.action :enable }.not_to raise_error
|
38
|
+
expect { resource.action :restart }.not_to raise_error
|
33
39
|
end
|
34
40
|
end
|
@@ -26,22 +26,17 @@ describe Chef::Resource::Link do
|
|
26
26
|
expect_any_instance_of(Chef::Resource::Link).to receive(:verify_links_supported!).and_return(true)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
30
|
-
expect(resource.
|
29
|
+
it "the target_file property is the name_property" do
|
30
|
+
expect(resource.target_file).to eql("fakey_fakerton")
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "sets the default action as :create" do
|
34
34
|
expect(resource.action).to eql([:create])
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
expect { resource.action action }.to raise_error(ArgumentError)
|
41
|
-
else
|
42
|
-
expect { resource.action action }.not_to raise_error
|
43
|
-
end
|
44
|
-
end
|
37
|
+
it "supports :create, :delete actions" do
|
38
|
+
expect { resource.action :create }.not_to raise_error
|
39
|
+
expect { resource.action :delete }.not_to raise_error
|
45
40
|
end
|
46
41
|
|
47
42
|
it "uses the object name as the target_file by default" do
|
@@ -24,20 +24,20 @@ describe Chef::Resource::Log do
|
|
24
24
|
let(:log_str) { "this is my string to log" }
|
25
25
|
let(:resource) { Chef::Resource::Log.new(log_str) }
|
26
26
|
|
27
|
-
it "supports the :write actions" do
|
28
|
-
expect(resource.allowed_actions).to include(:write)
|
29
|
-
end
|
30
|
-
|
31
27
|
it "has a name of log" do
|
32
28
|
expect(resource.resource_name).to eq(:log)
|
33
29
|
end
|
34
30
|
|
35
|
-
it "
|
36
|
-
expect(resource.
|
31
|
+
it "the message property is the name_property" do
|
32
|
+
expect(resource.message).to eql("this is my string to log")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "sets the default action as :write" do
|
36
|
+
expect(resource.action).to eql([:write])
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
40
|
-
expect
|
39
|
+
it "supports :write action" do
|
40
|
+
expect { resource.action :write }.not_to raise_error
|
41
41
|
end
|
42
42
|
|
43
43
|
it "accepts a string for the log message" do
|
@@ -25,7 +25,11 @@ describe Chef::Resource::MacosUserDefaults do
|
|
25
25
|
expect(resource.resource_name).to eql(:macos_userdefaults)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "sets the default action as :write" do
|
29
29
|
expect(resource.action).to eql([:write])
|
30
30
|
end
|
31
|
+
|
32
|
+
it "supports :write action" do
|
33
|
+
expect { resource.action :write }.not_to raise_error
|
34
|
+
end
|
31
35
|
end
|
@@ -30,3 +30,22 @@ describe Chef::Resource::MacportsPackage, "initialize" do
|
|
30
30
|
)
|
31
31
|
|
32
32
|
end
|
33
|
+
|
34
|
+
describe Chef::Resource::MacportsPackage, "defaults" do
|
35
|
+
let(:resource) { Chef::Resource::MacportsPackage.new("foo") }
|
36
|
+
|
37
|
+
it "sets the default action as :install" do
|
38
|
+
expect(resource.action).to eql([:install])
|
39
|
+
end
|
40
|
+
|
41
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
42
|
+
expect { resource.action :install }.not_to raise_error
|
43
|
+
expect { resource.action :lock }.not_to raise_error
|
44
|
+
expect { resource.action :purge }.not_to raise_error
|
45
|
+
expect { resource.action :reconfig }.not_to raise_error
|
46
|
+
expect { resource.action :remove }.not_to raise_error
|
47
|
+
expect { resource.action :unlock }.not_to raise_error
|
48
|
+
expect { resource.action :upgrade }.not_to raise_error
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|