chef 13.6.4-universal-mingw32 → 13.7.16-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/VERSION +1 -1
- data/acceptance/Gemfile +2 -2
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +1 -6
- data/distro/powershell/chef/chef.psm1 +1 -5
- data/lib/chef/api_client.rb +5 -5
- data/lib/chef/api_client_v1.rb +6 -6
- data/lib/chef/application.rb +3 -2
- data/lib/chef/application/knife.rb +4 -0
- data/lib/chef/chef_class.rb +2 -2
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -4
- data/lib/chef/client.rb +3 -3
- data/lib/chef/cookbook/chefignore.rb +4 -0
- data/lib/chef/cookbook/cookbook_collection.rb +2 -2
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/deprecated.rb +10 -0
- data/lib/chef/event_dispatch/base.rb +2 -2
- data/lib/chef/http.rb +10 -10
- data/lib/chef/knife.rb +16 -15
- data/lib/chef/knife/configure.rb +12 -36
- data/lib/chef/knife/cookbook_upload.rb +4 -4
- data/lib/chef/knife/core/bootstrap_context.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +6 -2
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/data_bag_show.rb +1 -1
- data/lib/chef/knife/edit.rb +1 -1
- data/lib/chef/knife/ssh.rb +47 -35
- data/lib/chef/knife/user_create.rb +2 -0
- data/lib/chef/knife/user_delete.rb +2 -0
- data/lib/chef/knife/user_edit.rb +2 -0
- data/lib/chef/knife/user_reregister.rb +2 -0
- data/lib/chef/knife/user_show.rb +2 -0
- data/lib/chef/mixin/powershell_out.rb +1 -1
- data/lib/chef/node/attribute.rb +46 -70
- data/lib/chef/node/attribute_collections.rb +5 -5
- data/lib/chef/node/common_api.rb +1 -1
- data/lib/chef/node/immutable_collections.rb +180 -23
- data/lib/chef/node/mixin/state_tracking.rb +6 -6
- data/lib/chef/node_map.rb +63 -45
- data/lib/chef/property.rb +8 -8
- data/lib/chef/provider.rb +9 -3
- data/lib/chef/provider/apt_preference.rb +1 -1
- data/lib/chef/provider/apt_repository.rb +1 -1
- data/lib/chef/provider/apt_update.rb +1 -1
- data/lib/chef/provider/file.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +6 -2
- data/lib/chef/provider/ifconfig.rb +96 -34
- data/lib/chef/provider/launchd.rb +0 -1
- data/lib/chef/provider/log.rb +3 -13
- data/lib/chef/provider/package/dnf.rb +1 -1
- data/lib/chef/provider/package/smartos.rb +2 -2
- data/lib/chef/provider/reboot.rb +12 -0
- data/lib/chef/provider/remote_directory.rb +1 -1
- data/lib/chef/provider/remote_file/http.rb +3 -2
- data/lib/chef/provider/service/solaris.rb +6 -2
- data/lib/chef/provider/systemd_unit.rb +34 -33
- data/lib/chef/provider/user/dscl.rb +1 -1
- data/lib/chef/provider/windows_path.rb +6 -7
- data/lib/chef/provider/windows_task.rb +89 -33
- data/lib/chef/provider/yum_repository.rb +24 -9
- data/lib/chef/resource/apt_package.rb +1 -0
- data/lib/chef/resource/apt_preference.rb +4 -0
- data/lib/chef/resource/apt_repository.rb +4 -0
- data/lib/chef/resource/apt_update.rb +3 -0
- data/lib/chef/resource/bash.rb +4 -0
- data/lib/chef/resource/batch.rb +5 -0
- data/lib/chef/resource/bff_package.rb +4 -0
- data/lib/chef/resource/breakpoint.rb +6 -0
- data/lib/chef/resource/cab_package.rb +6 -6
- data/lib/chef/resource/chef_gem.rb +13 -0
- data/lib/chef/resource/chocolatey_package.rb +4 -6
- data/lib/chef/resource/cookbook_file.rb +13 -15
- data/lib/chef/resource/cron.rb +2 -0
- data/lib/chef/resource/csh.rb +4 -0
- data/lib/chef/resource/directory.rb +8 -26
- data/lib/chef/resource/dnf_package.rb +5 -0
- data/lib/chef/resource/dpkg_package.rb +2 -0
- data/lib/chef/resource/dsc_resource.rb +5 -0
- data/lib/chef/resource/dsc_script.rb +6 -0
- data/lib/chef/resource/env.rb +3 -0
- data/lib/chef/resource/erl_call.rb +5 -0
- data/lib/chef/resource/execute.rb +5 -1
- data/lib/chef/resource/file.rb +2 -1
- data/lib/chef/resource/file/verification.rb +10 -0
- data/lib/chef/resource/freebsd_package.rb +10 -2
- data/lib/chef/resource/gem_package.rb +2 -0
- data/lib/chef/resource/git.rb +2 -0
- data/lib/chef/resource/group.rb +1 -0
- data/lib/chef/resource/homebrew_package.rb +3 -0
- data/lib/chef/resource/http_request.rb +2 -0
- data/lib/chef/resource/ifconfig.rb +23 -150
- data/lib/chef/resource/ips_package.rb +1 -0
- data/lib/chef/resource/ksh.rb +6 -0
- data/lib/chef/resource/launchd.rb +5 -4
- data/lib/chef/resource/link.rb +10 -0
- data/lib/chef/resource/log.rb +19 -46
- data/lib/chef/resource/macports_package.rb +1 -0
- data/lib/chef/resource/mdadm.rb +4 -0
- data/lib/chef/resource/mount.rb +1 -0
- data/lib/chef/resource/msu_package.rb +7 -8
- data/lib/chef/resource/ohai.rb +2 -0
- data/lib/chef/resource/openbsd_package.rb +3 -0
- data/lib/chef/resource/osx_profile.rb +10 -40
- data/lib/chef/resource/package.rb +6 -0
- data/lib/chef/resource/pacman_package.rb +1 -0
- data/lib/chef/resource/paludis_package.rb +3 -0
- data/lib/chef/resource/perl.rb +4 -0
- data/lib/chef/resource/portage_package.rb +1 -0
- data/lib/chef/resource/powershell_package.rb +5 -0
- data/lib/chef/resource/powershell_script.rb +8 -0
- data/lib/chef/resource/python.rb +4 -0
- data/lib/chef/resource/reboot.rb +14 -20
- data/lib/chef/resource/registry_key.rb +1 -0
- data/lib/chef/resource/remote_directory.rb +3 -0
- data/lib/chef/resource/remote_file.rb +2 -0
- data/lib/chef/resource/resource_notification.rb +17 -0
- data/lib/chef/resource/route.rb +1 -0
- data/lib/chef/resource/rpm_package.rb +1 -0
- data/lib/chef/resource/ruby.rb +4 -0
- data/lib/chef/resource/ruby_block.rb +3 -0
- data/lib/chef/resource/script.rb +4 -0
- data/lib/chef/resource/service.rb +1 -0
- data/lib/chef/resource/smartos_package.rb +1 -0
- data/lib/chef/resource/solaris_package.rb +1 -0
- data/lib/chef/resource/subversion.rb +1 -0
- data/lib/chef/resource/systemd_unit.rb +6 -0
- data/lib/chef/resource/template.rb +9 -0
- data/lib/chef/resource/user.rb +1 -0
- data/lib/chef/resource/windows_package.rb +2 -0
- data/lib/chef/resource/windows_path.rb +5 -10
- data/lib/chef/resource/windows_service.rb +3 -0
- data/lib/chef/resource/windows_task.rb +66 -87
- data/lib/chef/resource/yum_repository.rb +26 -22
- data/lib/chef/resource/zypper_package.rb +2 -0
- data/lib/chef/resource/zypper_repository.rb +6 -1
- data/lib/chef/run_context.rb +8 -2
- data/lib/chef/server_api.rb +1 -0
- data/lib/chef/util/selinux.rb +5 -4
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version/platform.rb +18 -0
- data/lib/chef/version_constraint/platform.rb +2 -0
- data/spec/data/client.d_00/02-strings.rb +2 -0
- data/spec/functional/assets/chefinittest +6 -4
- data/spec/functional/knife/ssh_spec.rb +54 -7
- data/spec/functional/resource/bff_spec.rb +3 -3
- data/spec/functional/resource/ifconfig_spec.rb +1 -1
- data/spec/functional/resource/mount_spec.rb +7 -3
- data/spec/functional/resource/user/useradd_spec.rb +4 -4
- data/spec/functional/resource/windows_task_spec.rb +6 -6
- data/spec/functional/win32/security_spec.rb +7 -33
- data/spec/integration/knife/data_bag_show_spec.rb +1 -1
- data/spec/integration/recipes/noop_resource_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +30 -30
- data/spec/integration/recipes/resource_action_spec.rb +2 -2
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +71 -15
- data/spec/spec_helper.rb +19 -0
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/unit/application_dot_d.rb +2 -0
- data/spec/support/shared/unit/execute_resource.rb +8 -1
- data/spec/support/shared/unit/provider/file.rb +9 -1
- data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +10 -7
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +2 -2
- data/spec/unit/client_spec.rb +1 -1
- data/spec/unit/deprecated_spec.rb +4 -4
- data/spec/unit/http_spec.rb +9 -0
- data/spec/unit/knife/bootstrap_spec.rb +5 -0
- data/spec/unit/knife/configure_spec.rb +10 -60
- data/spec/unit/knife/data_bag_create_spec.rb +40 -2
- data/spec/unit/knife/data_bag_show_spec.rb +16 -2
- data/spec/unit/knife/ssh_spec.rb +85 -39
- data/spec/unit/knife_spec.rb +2 -0
- data/spec/unit/lwrp_spec.rb +5 -3
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +7 -6
- data/spec/unit/node/attribute_spec.rb +55 -24
- data/spec/unit/node/immutable_collections_spec.rb +28 -14
- data/spec/unit/node/vivid_mash_spec.rb +27 -10
- data/spec/unit/node_map_spec.rb +34 -0
- data/spec/unit/property_spec.rb +13 -13
- data/spec/unit/provider/group/dscl_spec.rb +14 -5
- data/spec/unit/provider/ifconfig_spec.rb +10 -3
- data/spec/unit/provider/remote_file/http_spec.rb +23 -19
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +6 -5
- data/spec/unit/provider/user/dscl_spec.rb +26 -0
- data/spec/unit/provider/windows_task_spec.rb +148 -4
- data/spec/unit/provider_spec.rb +1 -1
- data/spec/unit/resource/apt_package_spec.rb +1 -1
- data/spec/unit/resource/bash_spec.rb +8 -10
- data/spec/unit/resource/batch_spec.rb +1 -1
- data/spec/unit/resource/cab_package_spec.rb +19 -1
- data/spec/unit/resource/chef_gem_spec.rb +3 -3
- data/spec/unit/resource/chocolatey_package_spec.rb +10 -10
- data/spec/unit/resource/conditional_spec.rb +2 -2
- data/spec/unit/resource/cookbook_file_spec.rb +24 -30
- data/spec/unit/resource/cron_spec.rb +79 -82
- data/spec/unit/resource/csh_spec.rb +8 -10
- data/spec/unit/resource/deploy_spec.rb +1 -1
- data/spec/unit/resource/directory_spec.rb +28 -31
- data/spec/unit/resource/dnf_package_spec.rb +9 -9
- data/spec/unit/resource/env_spec.rb +7 -7
- data/spec/unit/resource/erl_call_spec.rb +9 -9
- data/spec/unit/resource/execute_spec.rb +6 -6
- data/spec/unit/resource/file/verification_spec.rb +18 -4
- data/spec/unit/resource/file_spec.rb +53 -56
- data/spec/unit/resource/freebsd_package_spec.rb +7 -7
- data/spec/unit/resource/gem_package_spec.rb +1 -1
- data/spec/unit/resource/git_spec.rb +7 -9
- data/spec/unit/resource/group_spec.rb +60 -70
- data/spec/unit/resource/http_request_spec.rb +16 -19
- data/spec/unit/resource/ifconfig_spec.rb +3 -3
- data/spec/unit/resource/ips_package_spec.rb +3 -5
- data/spec/unit/resource/ksh_spec.rb +8 -10
- data/spec/unit/resource/launchd_spec.rb +17 -10
- data/spec/unit/resource/link_spec.rb +53 -53
- data/spec/unit/resource/log_spec.rb +24 -28
- data/spec/unit/resource/mdadm_spec.rb +42 -44
- data/spec/unit/resource/mount_spec.rb +97 -99
- data/spec/unit/resource/msu_package_spec.rb +14 -8
- data/spec/unit/resource/ohai_spec.rb +15 -17
- data/spec/unit/resource/openbsd_package_spec.rb +3 -3
- data/spec/unit/resource/osx_profile_spec.rb +7 -7
- data/spec/unit/resource/package_spec.rb +36 -40
- data/spec/unit/resource/perl_spec.rb +8 -11
- data/spec/unit/resource/portage_package_spec.rb +8 -10
- data/spec/unit/resource/powershell_package_spec.rb +9 -9
- data/spec/unit/resource/python_spec.rb +8 -11
- data/spec/unit/resource/reboot_spec.rb +50 -0
- data/spec/unit/resource/registry_key_spec.rb +84 -98
- data/spec/unit/resource/remote_directory_spec.rb +40 -42
- data/spec/unit/resource/remote_file_spec.rb +78 -80
- data/spec/unit/resource/route_spec.rb +42 -44
- data/spec/unit/resource/rpm_package_spec.rb +5 -7
- data/spec/unit/resource/ruby_block_spec.rb +14 -16
- data/spec/unit/resource/ruby_spec.rb +8 -12
- data/spec/unit/resource/scm_spec.rb +66 -69
- data/spec/unit/resource/script_spec.rb +1 -1
- data/spec/unit/resource/service_spec.rb +80 -83
- data/spec/unit/resource/smartos_package_spec.rb +5 -0
- data/spec/unit/resource/solaris_package_spec.rb +3 -5
- data/spec/unit/resource/subversion_spec.rb +18 -16
- data/spec/unit/resource/systemd_unit_spec.rb +50 -54
- data/spec/unit/resource/template_spec.rb +56 -61
- data/spec/unit/resource/user_spec.rb +47 -53
- data/spec/unit/resource/windows_package_spec.rb +1 -1
- data/spec/unit/resource/windows_path_spec.rb +11 -8
- data/spec/unit/resource/windows_task_spec.rb +129 -33
- data/spec/unit/resource/yum_package_spec.rb +1 -1
- data/spec/unit/resource/yum_repository_spec.rb +61 -8
- data/spec/unit/resource/zypper_repository_spec.rb +17 -18
- data/spec/unit/util/selinux_spec.rb +3 -6
- data/tasks/dependencies.rb +0 -5
- data/tasks/rspec.rb +1 -1
- metadata +7 -19
- data/acceptance/.DS_Store +0 -0
- data/acceptance/.bundle/config +0 -2
- data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
- data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
- data/distro/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/chef/.DS_Store +0 -0
- data/lib/chef/knife/.DS_Store +0 -0
- data/lib/chef/mixin/.DS_Store +0 -0
- data/spec/.DS_Store +0 -0
- data/spec/functional/.DS_Store +0 -0
- data/spec/support/.DS_Store +0 -0
- data/spec/unit/.DS_Store +0 -0
- data/tasks/.DS_Store +0 -0
@@ -21,87 +21,85 @@ require "spec_helper"
|
|
21
21
|
|
22
22
|
describe Chef::Resource::Route do
|
23
23
|
|
24
|
-
|
25
|
-
@resource = Chef::Resource::Route.new("10.0.0.10")
|
26
|
-
end
|
24
|
+
let(:resource) { Chef::Resource::Route.new("10.0.0.10") }
|
27
25
|
|
28
|
-
it "
|
29
|
-
expect(
|
30
|
-
expect(
|
26
|
+
it "creates a new Chef::Resource::Route" do
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
28
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Route)
|
31
29
|
end
|
32
30
|
|
33
|
-
it "
|
34
|
-
expect(
|
31
|
+
it "has a name" do
|
32
|
+
expect(resource.name).to eql("10.0.0.10")
|
35
33
|
end
|
36
34
|
|
37
|
-
it "
|
38
|
-
expect(
|
35
|
+
it "has a default action of 'add'" do
|
36
|
+
expect(resource.action).to eql([:add])
|
39
37
|
end
|
40
38
|
|
41
|
-
it "
|
42
|
-
expect {
|
43
|
-
expect {
|
44
|
-
expect {
|
39
|
+
it "accepts add or delete for action" do
|
40
|
+
expect { resource.action :add }.not_to raise_error
|
41
|
+
expect { resource.action :delete }.not_to raise_error
|
42
|
+
expect { resource.action :lolcat }.to raise_error(ArgumentError)
|
45
43
|
end
|
46
44
|
|
47
|
-
it "
|
48
|
-
expect(
|
45
|
+
it "uses the object name as the target by default" do
|
46
|
+
expect(resource.target).to eql("10.0.0.10")
|
49
47
|
end
|
50
48
|
|
51
|
-
it "
|
52
|
-
|
53
|
-
expect(
|
49
|
+
it "allows you to specify the netmask" do
|
50
|
+
resource.netmask "255.255.255.0"
|
51
|
+
expect(resource.netmask).to eql("255.255.255.0")
|
54
52
|
end
|
55
53
|
|
56
|
-
it "
|
57
|
-
|
58
|
-
expect(
|
54
|
+
it "allows you to specify the gateway" do
|
55
|
+
resource.gateway "10.0.0.1"
|
56
|
+
expect(resource.gateway).to eql("10.0.0.1")
|
59
57
|
end
|
60
58
|
|
61
|
-
it "
|
62
|
-
|
63
|
-
expect(
|
59
|
+
it "allows you to specify the metric" do
|
60
|
+
resource.metric 10
|
61
|
+
expect(resource.metric).to eql(10)
|
64
62
|
end
|
65
63
|
|
66
|
-
it "
|
67
|
-
|
68
|
-
expect(
|
64
|
+
it "allows you to specify the device" do
|
65
|
+
resource.device "eth0"
|
66
|
+
expect(resource.device).to eql("eth0")
|
69
67
|
end
|
70
68
|
|
71
|
-
it "
|
72
|
-
|
73
|
-
expect(
|
69
|
+
it "allows you to specify the route type" do
|
70
|
+
resource.route_type "host"
|
71
|
+
expect(resource.route_type).to eql(:host)
|
74
72
|
end
|
75
73
|
|
76
|
-
it "
|
77
|
-
expect(
|
74
|
+
it "defaults to a host route type" do
|
75
|
+
expect(resource.route_type).to eql(:host)
|
78
76
|
end
|
79
77
|
|
80
|
-
it "
|
81
|
-
|
82
|
-
expect(
|
78
|
+
it "accepts a net route type" do
|
79
|
+
resource.route_type :net
|
80
|
+
expect(resource.route_type).to eql(:net)
|
83
81
|
end
|
84
82
|
|
85
|
-
it "
|
86
|
-
expect {
|
83
|
+
it "rejects any other route_type but :host and :net" do
|
84
|
+
expect { resource.route_type "lolcat" }.to raise_error(ArgumentError)
|
87
85
|
end
|
88
86
|
|
89
87
|
describe "when it has netmask, gateway, and device" do
|
90
88
|
before do
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
resource.target("charmander")
|
90
|
+
resource.netmask("lemask")
|
91
|
+
resource.gateway("111.111.111")
|
92
|
+
resource.device("forcefield")
|
95
93
|
end
|
96
94
|
|
97
95
|
it "describes its state" do
|
98
|
-
state =
|
96
|
+
state = resource.state_for_resource_reporter
|
99
97
|
expect(state[:netmask]).to eq("lemask")
|
100
98
|
expect(state[:gateway]).to eq("111.111.111")
|
101
99
|
end
|
102
100
|
|
103
101
|
it "returns the target as its identity" do
|
104
|
-
expect(
|
102
|
+
expect(resource.identity).to eq("charmander")
|
105
103
|
end
|
106
104
|
end
|
107
105
|
end
|
@@ -34,13 +34,11 @@ describe Chef::Resource::RpmPackage, "initialize" do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe Chef::Resource::RpmPackage, "allow_downgrade" do
|
37
|
-
|
38
|
-
@resource = Chef::Resource::RpmPackage.new("foo")
|
39
|
-
end
|
37
|
+
let(:resource) { Chef::Resource::RpmPackage.new("foo") }
|
40
38
|
|
41
|
-
it "
|
42
|
-
expect {
|
43
|
-
expect {
|
44
|
-
expect {
|
39
|
+
it "allows you to specify whether allow_downgrade is true or false" do
|
40
|
+
expect { resource.allow_downgrade true }.not_to raise_error
|
41
|
+
expect { resource.allow_downgrade false }.not_to raise_error
|
42
|
+
expect { resource.allow_downgrade "monkey" }.to raise_error(ArgumentError)
|
45
43
|
end
|
46
44
|
end
|
@@ -21,41 +21,39 @@ require "spec_helper"
|
|
21
21
|
|
22
22
|
describe Chef::Resource::RubyBlock do
|
23
23
|
|
24
|
-
|
25
|
-
@resource = Chef::Resource::RubyBlock.new("fakey_fakerton")
|
26
|
-
end
|
24
|
+
let(:resource) { Chef::Resource::RubyBlock.new("fakey_fakerton") }
|
27
25
|
|
28
|
-
it "
|
29
|
-
expect(
|
30
|
-
expect(
|
26
|
+
it "creates a new Chef::Resource::RubyBlock" do
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
28
|
+
expect(resource).to be_a_kind_of(Chef::Resource::RubyBlock)
|
31
29
|
end
|
32
30
|
|
33
|
-
it "
|
34
|
-
expect(
|
31
|
+
it "has a default action of 'run'" do
|
32
|
+
expect(resource.action).to eql([:run])
|
35
33
|
end
|
36
34
|
|
37
|
-
it "
|
38
|
-
expect(
|
35
|
+
it "has a resource name of :ruby_block" do
|
36
|
+
expect(resource.resource_name).to eql(:ruby_block)
|
39
37
|
end
|
40
38
|
|
41
|
-
it "
|
42
|
-
expect(
|
39
|
+
it "accepts a ruby block/proc/.. for the 'block' parameter" do
|
40
|
+
expect(resource.block do
|
43
41
|
"foo"
|
44
42
|
end.call).to eql("foo")
|
45
43
|
end
|
46
44
|
|
47
45
|
it "allows the action to be 'create'" do
|
48
|
-
|
49
|
-
expect(
|
46
|
+
resource.action :create
|
47
|
+
expect(resource.action).to eq([:create])
|
50
48
|
end
|
51
49
|
|
52
50
|
describe "when it has been initialized with block code" do
|
53
51
|
before do
|
54
|
-
|
52
|
+
resource.block_name("puts 'harrrr'")
|
55
53
|
end
|
56
54
|
|
57
55
|
it "returns the block as its identity" do
|
58
|
-
expect(
|
56
|
+
expect(resource.identity).to eq("puts 'harrrr'")
|
59
57
|
end
|
60
58
|
end
|
61
59
|
end
|
@@ -19,22 +19,18 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Chef::Resource::Ruby do
|
22
|
+
let(:resource) { Chef::Resource::Ruby.new("fakey_fakerton") }
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
it "creates a new Chef::Resource::Ruby" do
|
25
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Ruby)
|
25
27
|
end
|
26
28
|
|
27
|
-
it "
|
28
|
-
expect(
|
29
|
-
expect(@resource).to be_a_kind_of(Chef::Resource::Ruby)
|
29
|
+
it "has a resource name of :ruby" do
|
30
|
+
expect(resource.resource_name).to eql(:ruby)
|
30
31
|
end
|
31
32
|
|
32
|
-
it "
|
33
|
-
expect(
|
33
|
+
it "has an interpreter of ruby" do
|
34
|
+
expect(resource.interpreter).to eql("ruby")
|
34
35
|
end
|
35
|
-
|
36
|
-
it "should have an interpreter of ruby" do
|
37
|
-
expect(@resource.interpreter).to eql("ruby")
|
38
|
-
end
|
39
|
-
|
40
36
|
end
|
@@ -20,174 +20,171 @@
|
|
20
20
|
require "spec_helper"
|
21
21
|
|
22
22
|
describe Chef::Resource::Scm do
|
23
|
+
let(:resource) { Chef::Resource::Scm.new("my awesome app") }
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should be a SCM resource" do
|
29
|
-
expect(@resource).to be_a_kind_of(Chef::Resource::Scm)
|
25
|
+
it "is a SCM resource" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Scm)
|
30
27
|
end
|
31
28
|
|
32
29
|
it "supports :checkout, :export, :sync, :diff, and :log actions" do
|
33
|
-
expect(
|
34
|
-
expect(
|
35
|
-
expect(
|
36
|
-
expect(
|
37
|
-
expect(
|
30
|
+
expect(resource.allowed_actions).to include(:checkout)
|
31
|
+
expect(resource.allowed_actions).to include(:export)
|
32
|
+
expect(resource.allowed_actions).to include(:sync)
|
33
|
+
expect(resource.allowed_actions).to include(:diff)
|
34
|
+
expect(resource.allowed_actions).to include(:log)
|
38
35
|
end
|
39
36
|
|
40
37
|
it "takes the destination path as a string" do
|
41
|
-
|
42
|
-
expect(
|
38
|
+
resource.destination "/path/to/deploy/dir"
|
39
|
+
expect(resource.destination).to eql("/path/to/deploy/dir")
|
43
40
|
end
|
44
41
|
|
45
42
|
it "takes a string for the repository URL" do
|
46
|
-
|
47
|
-
expect(
|
43
|
+
resource.repository "git://github.com/opscode/chef.git"
|
44
|
+
expect(resource.repository).to eql("git://github.com/opscode/chef.git")
|
48
45
|
end
|
49
46
|
|
50
47
|
it "takes a string for the revision" do
|
51
|
-
|
52
|
-
expect(
|
48
|
+
resource.revision "abcdef"
|
49
|
+
expect(resource.revision).to eql("abcdef")
|
53
50
|
end
|
54
51
|
|
55
52
|
it "defaults to the ``HEAD'' revision" do
|
56
|
-
expect(
|
53
|
+
expect(resource.revision).to eql("HEAD")
|
57
54
|
end
|
58
55
|
|
59
56
|
it "takes a string for the user to run as" do
|
60
|
-
|
61
|
-
expect(
|
57
|
+
resource.user "dr_deploy"
|
58
|
+
expect(resource.user).to eql("dr_deploy")
|
62
59
|
end
|
63
60
|
|
64
61
|
it "also takes an integer for the user to run as" do
|
65
|
-
|
66
|
-
expect(
|
62
|
+
resource.user 0
|
63
|
+
expect(resource.user).to eql(0)
|
67
64
|
end
|
68
65
|
|
69
66
|
it "takes a string for the group to run as, defaulting to nil" do
|
70
|
-
expect(
|
71
|
-
|
72
|
-
expect(
|
67
|
+
expect(resource.group).to be_nil
|
68
|
+
resource.group "opsdevs"
|
69
|
+
expect(resource.group).to eq("opsdevs")
|
73
70
|
end
|
74
71
|
|
75
72
|
it "also takes an integer for the group to run as" do
|
76
|
-
|
77
|
-
expect(
|
73
|
+
resource.group 23
|
74
|
+
expect(resource.group).to eq(23)
|
78
75
|
end
|
79
76
|
|
80
77
|
it "has a svn_username String attribute" do
|
81
|
-
|
82
|
-
expect(
|
78
|
+
resource.svn_username "moartestsplz"
|
79
|
+
expect(resource.svn_username).to eql("moartestsplz")
|
83
80
|
end
|
84
81
|
|
85
82
|
it "has a svn_password String attribute" do
|
86
|
-
|
87
|
-
expect(
|
83
|
+
resource.svn_password "taftplz"
|
84
|
+
expect(resource.svn_password).to eql("taftplz")
|
88
85
|
end
|
89
86
|
|
90
87
|
it "has a svn_arguments String attribute" do
|
91
|
-
|
92
|
-
expect(
|
88
|
+
resource.svn_arguments "--more-taft plz"
|
89
|
+
expect(resource.svn_arguments).to eql("--more-taft plz")
|
93
90
|
end
|
94
91
|
|
95
92
|
it "has a svn_info_args String attribute" do
|
96
|
-
expect(
|
97
|
-
|
98
|
-
expect(
|
93
|
+
expect(resource.svn_info_args).to be_nil
|
94
|
+
resource.svn_info_args("--no-moar-plaintext-creds yep")
|
95
|
+
expect(resource.svn_info_args).to eq("--no-moar-plaintext-creds yep")
|
99
96
|
end
|
100
97
|
|
101
98
|
it "takes the depth as an integer for shallow clones" do
|
102
|
-
|
103
|
-
expect(
|
104
|
-
expect {
|
99
|
+
resource.depth 5
|
100
|
+
expect(resource.depth).to eq(5)
|
101
|
+
expect { resource.depth "five" }.to raise_error(ArgumentError)
|
105
102
|
end
|
106
103
|
|
107
104
|
it "defaults to nil depth for a full clone" do
|
108
|
-
expect(
|
105
|
+
expect(resource.depth).to be_nil
|
109
106
|
end
|
110
107
|
|
111
108
|
it "takes a boolean for #enable_submodules" do
|
112
|
-
|
113
|
-
expect(
|
114
|
-
expect {
|
109
|
+
resource.enable_submodules true
|
110
|
+
expect(resource.enable_submodules).to be_truthy
|
111
|
+
expect { resource.enable_submodules "lolz" }.to raise_error(ArgumentError)
|
115
112
|
end
|
116
113
|
|
117
114
|
it "defaults to not enabling submodules" do
|
118
|
-
expect(
|
115
|
+
expect(resource.enable_submodules).to be_falsey
|
119
116
|
end
|
120
117
|
|
121
118
|
it "takes a boolean for #enable_checkout" do
|
122
|
-
|
123
|
-
expect(
|
124
|
-
expect {
|
119
|
+
resource.enable_checkout true
|
120
|
+
expect(resource.enable_checkout).to be_truthy
|
121
|
+
expect { resource.enable_checkout "lolz" }.to raise_error(ArgumentError)
|
125
122
|
end
|
126
123
|
|
127
124
|
it "defaults to enabling checkout" do
|
128
|
-
expect(
|
125
|
+
expect(resource.enable_checkout).to be_truthy
|
129
126
|
end
|
130
127
|
|
131
128
|
it "takes a string for the remote" do
|
132
|
-
|
133
|
-
expect(
|
134
|
-
expect {
|
129
|
+
resource.remote "opscode"
|
130
|
+
expect(resource.remote).to eql("opscode")
|
131
|
+
expect { resource.remote 1337 }.to raise_error(ArgumentError)
|
135
132
|
end
|
136
133
|
|
137
134
|
it "defaults to ``origin'' for the remote" do
|
138
|
-
expect(
|
135
|
+
expect(resource.remote).to eq("origin")
|
139
136
|
end
|
140
137
|
|
141
138
|
it "takes a string for the ssh wrapper" do
|
142
|
-
|
143
|
-
expect(
|
139
|
+
resource.ssh_wrapper "with_ssh_fu"
|
140
|
+
expect(resource.ssh_wrapper).to eql("with_ssh_fu")
|
144
141
|
end
|
145
142
|
|
146
143
|
it "defaults to nil for the ssh wrapper" do
|
147
|
-
expect(
|
144
|
+
expect(resource.ssh_wrapper).to be_nil
|
148
145
|
end
|
149
146
|
|
150
147
|
it "defaults to nil for the environment" do
|
151
|
-
expect(
|
148
|
+
expect(resource.environment).to be_nil
|
152
149
|
end
|
153
150
|
|
154
151
|
describe "when it has a timeout attribute" do
|
155
152
|
let(:ten_seconds) { 10 }
|
156
|
-
before {
|
153
|
+
before { resource.timeout(ten_seconds) }
|
157
154
|
it "stores this timeout" do
|
158
|
-
expect(
|
155
|
+
expect(resource.timeout).to eq(ten_seconds)
|
159
156
|
end
|
160
157
|
end
|
161
158
|
describe "when it has no timeout attribute" do
|
162
|
-
it "
|
163
|
-
expect(
|
159
|
+
it "has no default timeout" do
|
160
|
+
expect(resource.timeout).to be_nil
|
164
161
|
end
|
165
162
|
end
|
166
163
|
|
167
164
|
describe "when it has repository, revision, user, and group" do
|
168
165
|
before do
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
166
|
+
resource.destination("hell")
|
167
|
+
resource.repository("apt")
|
168
|
+
resource.revision("1.2.3")
|
169
|
+
resource.user("root")
|
170
|
+
resource.group("super_adventure_club")
|
174
171
|
end
|
175
172
|
|
176
173
|
it "describes its state" do
|
177
|
-
state =
|
174
|
+
state = resource.state_for_resource_reporter
|
178
175
|
expect(state[:revision]).to eq("1.2.3")
|
179
176
|
end
|
180
177
|
|
181
178
|
it "returns the destination as its identity" do
|
182
|
-
expect(
|
179
|
+
expect(resource.identity).to eq("hell")
|
183
180
|
end
|
184
181
|
end
|
185
182
|
|
186
183
|
describe "when it has a environment attribute" do
|
187
184
|
let(:test_environment) { { "CHEF_ENV" => "/tmp" } }
|
188
|
-
before {
|
185
|
+
before { resource.environment(test_environment) }
|
189
186
|
it "stores this environment" do
|
190
|
-
expect(
|
187
|
+
expect(resource.environment).to eq(test_environment)
|
191
188
|
end
|
192
189
|
end
|
193
190
|
end
|