chef 10.14.4 → 10.16.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. data/distro/common/html/chef-client.8.html +4 -4
  2. data/distro/common/html/chef-expander.8.html +4 -4
  3. data/distro/common/html/chef-expanderctl.8.html +4 -4
  4. data/distro/common/html/chef-server-webui.8.html +4 -4
  5. data/distro/common/html/chef-server.8.html +182 -0
  6. data/distro/common/html/chef-solo.8.html +4 -4
  7. data/distro/common/html/chef-solr.8.html +4 -4
  8. data/distro/common/html/knife-bootstrap.1.html +5 -5
  9. data/distro/common/html/knife-client.1.html +4 -4
  10. data/distro/common/html/knife-configure.1.html +5 -5
  11. data/distro/common/html/knife-cookbook-site.1.html +4 -4
  12. data/distro/common/html/knife-cookbook.1.html +8 -8
  13. data/distro/common/html/knife-data-bag.1.html +4 -4
  14. data/distro/common/html/knife-environment.1.html +7 -7
  15. data/distro/common/html/knife-exec.1.html +4 -4
  16. data/distro/common/html/knife-index.1.html +4 -4
  17. data/distro/common/html/knife-node.1.html +5 -5
  18. data/distro/common/html/knife-role.1.html +4 -4
  19. data/distro/common/html/knife-search.1.html +6 -6
  20. data/distro/common/html/knife-ssh.1.html +4 -4
  21. data/distro/common/html/knife-status.1.html +5 -5
  22. data/distro/common/html/knife-tag.1.html +4 -4
  23. data/distro/common/html/knife.1.html +4 -4
  24. data/distro/common/html/shef.1.html +4 -4
  25. data/distro/common/man/man1/knife-bootstrap.1 +1 -1
  26. data/distro/common/man/man1/knife-client.1 +1 -1
  27. data/distro/common/man/man1/knife-configure.1 +1 -1
  28. data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
  29. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  30. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  31. data/distro/common/man/man1/knife-environment.1 +1 -1
  32. data/distro/common/man/man1/knife-exec.1 +1 -1
  33. data/distro/common/man/man1/knife-index.1 +1 -1
  34. data/distro/common/man/man1/knife-node.1 +1 -1
  35. data/distro/common/man/man1/knife-role.1 +1 -1
  36. data/distro/common/man/man1/knife-search.1 +1 -1
  37. data/distro/common/man/man1/knife-ssh.1 +1 -1
  38. data/distro/common/man/man1/knife-status.1 +1 -1
  39. data/distro/common/man/man1/knife-tag.1 +1 -1
  40. data/distro/common/man/man1/knife.1 +1 -1
  41. data/distro/common/man/man1/shef.1 +1 -1
  42. data/distro/common/man/man8/chef-client.8 +1 -1
  43. data/distro/common/man/man8/chef-expander.8 +1 -1
  44. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  45. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  46. data/distro/common/man/man8/chef-server.8 +1 -1
  47. data/distro/common/man/man8/chef-solo.8 +1 -1
  48. data/distro/common/man/man8/chef-solr.8 +1 -1
  49. data/distro/debian/etc/init.d/chef-client +1 -1
  50. data/distro/debian/etc/init.d/chef-expander +1 -1
  51. data/distro/debian/etc/init.d/chef-server +1 -1
  52. data/distro/debian/etc/init.d/chef-server-webui +1 -1
  53. data/distro/debian/etc/init.d/chef-solr +1 -1
  54. data/lib/chef/application/client.rb +3 -3
  55. data/lib/chef/client.rb +4 -1
  56. data/lib/chef/config.rb +2 -1
  57. data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -0
  58. data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -0
  59. data/lib/chef/knife/bootstrap/chef-full.erb +2 -1
  60. data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -0
  61. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -0
  62. data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +2 -0
  63. data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +2 -0
  64. data/lib/chef/knife/configure.rb +19 -0
  65. data/lib/chef/knife/data_bag_from_file.rb +1 -1
  66. data/lib/chef/knife/environment_from_file.rb +41 -8
  67. data/lib/chef/knife/ssh.rb +5 -1
  68. data/lib/chef/provider/cookbook_file.rb +4 -4
  69. data/lib/chef/provider/directory.rb +3 -0
  70. data/lib/chef/provider/file.rb +49 -3
  71. data/lib/chef/provider/ifconfig.rb +1 -1
  72. data/lib/chef/provider/package.rb +2 -0
  73. data/lib/chef/provider/package/pacman.rb +10 -1
  74. data/lib/chef/provider/remote_file.rb +1 -1
  75. data/lib/chef/provider/service.rb +22 -0
  76. data/lib/chef/provider/template.rb +9 -1
  77. data/lib/chef/resource.rb +1 -1
  78. data/lib/chef/resource/cookbook_file.rb +1 -0
  79. data/lib/chef/resource/cron.rb +5 -0
  80. data/lib/chef/resource/deploy.rb +6 -1
  81. data/lib/chef/resource/directory.rb +6 -0
  82. data/lib/chef/resource/env.rb +5 -0
  83. data/lib/chef/resource/erl_call.rb +3 -0
  84. data/lib/chef/resource/execute.rb +3 -0
  85. data/lib/chef/resource/file.rb +5 -5
  86. data/lib/chef/resource/group.rb +5 -0
  87. data/lib/chef/resource/http_request.rb +3 -0
  88. data/lib/chef/resource/ifconfig.rb +5 -0
  89. data/lib/chef/resource/link.rb +6 -1
  90. data/lib/chef/resource/log.rb +19 -16
  91. data/lib/chef/resource/mdadm.rb +5 -0
  92. data/lib/chef/resource/mount.rb +5 -0
  93. data/lib/chef/resource/ohai.rb +14 -0
  94. data/lib/chef/resource/package.rb +2 -1
  95. data/lib/chef/resource/remote_directory.rb +5 -0
  96. data/lib/chef/resource/route.rb +6 -1
  97. data/lib/chef/resource/ruby_block.rb +11 -0
  98. data/lib/chef/resource/scm.rb +4 -0
  99. data/lib/chef/resource/script.rb +3 -0
  100. data/lib/chef/resource/service.rb +5 -0
  101. data/lib/chef/resource/subversion.rb +2 -1
  102. data/lib/chef/resource/template.rb +1 -0
  103. data/lib/chef/resource/user.rb +4 -0
  104. data/lib/chef/resource_reporter.rb +71 -27
  105. data/lib/chef/rest.rb +8 -4
  106. data/lib/chef/run_list.rb +2 -2
  107. data/lib/chef/scan_access_control.rb +1 -1
  108. data/lib/chef/version.rb +1 -1
  109. data/spec/unit/client_spec.rb +6 -2
  110. data/spec/unit/knife/configure_spec.rb +121 -25
  111. data/spec/unit/knife/data_bag_from_file_spec.rb +5 -3
  112. data/spec/unit/knife/environment_from_file_spec.rb +23 -0
  113. data/spec/unit/provider/cookbook_file_spec.rb +3 -0
  114. data/spec/unit/provider/directory_spec.rb +16 -17
  115. data/spec/unit/provider/file_spec.rb +75 -0
  116. data/spec/unit/provider/ifconfig_spec.rb +2 -2
  117. data/spec/unit/provider/package/pacman_spec.rb +29 -0
  118. data/spec/unit/provider/package_spec.rb +4 -0
  119. data/spec/unit/provider/remote_directory_spec.rb +6 -1
  120. data/spec/unit/provider/remote_file_spec.rb +7 -0
  121. data/spec/unit/resource/cookbook_file_spec.rb +42 -1
  122. data/spec/unit/resource/cron_spec.rb +27 -0
  123. data/spec/unit/resource/deploy_spec.rb +27 -0
  124. data/spec/unit/resource/directory_spec.rb +20 -0
  125. data/spec/unit/resource/env_spec.rb +19 -0
  126. data/spec/unit/resource/erl_call_spec.rb +12 -0
  127. data/spec/unit/resource/execute_spec.rb +16 -0
  128. data/spec/unit/resource/group_spec.rb +17 -1
  129. data/spec/unit/resource/http_request_spec.rb +13 -0
  130. data/spec/unit/resource/ifconfig_spec.rb +46 -0
  131. data/spec/unit/resource/link_spec.rb +21 -0
  132. data/spec/unit/resource/log_spec.rb +10 -0
  133. data/spec/unit/resource/mdadm_spec.rb +22 -0
  134. data/spec/unit/resource/mount_spec.rb +20 -0
  135. data/spec/unit/resource/ohai_spec.rb +18 -0
  136. data/spec/unit/resource/package_spec.rb +3 -0
  137. data/spec/unit/resource/remote_directory_spec.rb +22 -0
  138. data/spec/unit/resource/remote_file_spec.rb +40 -0
  139. data/spec/unit/resource/route_spec.rb +19 -0
  140. data/spec/unit/resource/ruby_block_spec.rb +11 -0
  141. data/spec/unit/resource/scm_spec.rb +20 -0
  142. data/spec/unit/resource/script_spec.rb +14 -0
  143. data/spec/unit/resource/service_spec.rb +21 -0
  144. data/spec/unit/resource/user_spec.rb +21 -0
  145. data/spec/unit/resource_reporter_spec.rb +260 -134
  146. data/spec/unit/run_list_spec.rb +14 -0
  147. metadata +15 -10
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -105,4 +106,19 @@ describe Chef::Resource::Execute do
105
106
  @resource.creates.should eql("something")
106
107
  end
107
108
 
109
+ describe "when it has cwd, environment, group, path, return value, and a user" do
110
+ before do
111
+ @resource.command("grep")
112
+ @resource.cwd("/tmp/")
113
+ @resource.environment({ :one => :two })
114
+ @resource.group("legos")
115
+ @resource.path(["/var/local/"])
116
+ @resource.returns(1)
117
+ @resource.user("root")
118
+ end
119
+
120
+ it "returns the command as its identity" do
121
+ @resource.identity.should == "grep"
122
+ end
123
+ end
108
124
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: AJ Christensen (<aj@opscode.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>);
3
4
  # Copyright:: Copyright (c) 2008 OpsCode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -128,5 +129,20 @@ describe Chef::Resource::Group, "append" do
128
129
  it "should not allow a hash" do
129
130
  lambda { @resource.send(:gid, { :aj => "is freakin awesome" }) }.should raise_error(ArgumentError)
130
131
  end
131
-
132
+
133
+ describe "when it has members" do
134
+ before do
135
+ @resource.group_name("pokemon")
136
+ @resource.members(["blastoise", "pikachu"])
137
+ end
138
+
139
+ it "describes its state" do
140
+ state = @resource.state
141
+ state[:members].should eql(["blastoise", "pikachu"])
142
+ end
143
+
144
+ it "returns the group name as its identity" do
145
+ @resource.identity.should == "pokemon"
146
+ end
147
+ end
132
148
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -42,5 +43,17 @@ describe Chef::Resource::HttpRequest do
42
43
  @resource.message "monkeybars"
43
44
  @resource.message.should eql("monkeybars")
44
45
  end
46
+
47
+ describe "when it has a message and headers" do
48
+ before do
49
+ @resource.url("http://www.trololol.net")
50
+ @resource.message("Get sum post brah.")
51
+ @resource.headers({"head" => "tail"})
52
+ end
53
+
54
+ it "returns the url as its identity" do
55
+ @resource.identity.should == "http://www.trololol.net"
56
+ end
57
+ end
45
58
 
46
59
  end
@@ -0,0 +1,46 @@
1
+ #
2
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
+ # Copyright:: Copyright (c) 2009 Joe Williams
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'spec_helper'
20
+
21
+ describe Chef::Resource::Ifconfig do
22
+
23
+ before(:each) do
24
+ @resource = Chef::Resource::Ifconfig.new("fakey_fakerton")
25
+ end
26
+
27
+ describe "when it has target, hardware address, inet address, and a mask" do
28
+ before do
29
+ @resource.device("charmander")
30
+ @resource.target("team_rocket")
31
+ @resource.hwaddr("11.2223.223")
32
+ @resource.inet_addr("434.2343.23")
33
+ @resource.mask("255.255.545")
34
+ end
35
+
36
+ it "describes its state" do
37
+ state = @resource.state
38
+ state[:inet_addr].should == "434.2343.23"
39
+ state[:mask].should == "255.255.545"
40
+ end
41
+
42
+ it "returns the device as its identity" do
43
+ @resource.identity.should == "charmander"
44
+ end
45
+ end
46
+ end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -94,4 +95,24 @@ describe Chef::Resource::Link do
94
95
  lambda { @resource.owner "root*goo" }.should raise_error(ArgumentError)
95
96
  end
96
97
 
98
+ describe "when it has to, link_type, owner, and group" do
99
+ before do
100
+ @resource.target_file("/var/target.tar")
101
+ @resource.to("/to/dir/file.tar")
102
+ @resource.link_type(:symbolic)
103
+ @resource.owner("root")
104
+ @resource.group("0664")
105
+ end
106
+
107
+ it "describes its state" do
108
+ state = @resource.state
109
+ state[:to].should == "/to/dir/file.tar"
110
+ state[:owner].should == "root"
111
+ state[:group].should == "0664"
112
+ end
113
+
114
+ it "returns the target file as its identity" do
115
+ @resource.identity.should == "/var/target.tar"
116
+ end
117
+ end
97
118
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Cary Penniman (<cary@rightscale.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -47,5 +48,14 @@ describe Chef::Resource::Log do
47
48
  lambda { @resource.level :unsupported }.should raise_error(ArgumentError)
48
49
  end
49
50
 
51
+ describe "when the identity is defined" do
52
+ before do
53
+ @resource = Chef::Resource::Log.new("ery day I'm loggin-in")
54
+ end
55
+
56
+ it "returns the log string as its identity" do
57
+ @resource.identity.should == "ery day I'm loggin-in"
58
+ end
59
+ end
50
60
  end
51
61
 
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Joe Williams (<joe@joetify.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2009 Joe Williams
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -77,4 +78,25 @@ describe Chef::Resource::Mdadm do
77
78
  @resource.exists true
78
79
  @resource.exists.should eql(true)
79
80
  end
81
+
82
+ describe "when it has devices, level, and chunk" do
83
+ before do
84
+ @resource.raid_device("raider")
85
+ @resource.devices(["device1", "device2"])
86
+ @resource.level(1)
87
+ @resource.chunk(42)
88
+ end
89
+
90
+ it "describes its state" do
91
+ state = @resource.state
92
+ state[:devices].should eql(["device1", "device2"])
93
+ state[:level].should == 1
94
+ state[:chunk].should == 42
95
+ end
96
+
97
+ it "returns the raid device as its identity" do
98
+ @resource.identity.should == "raider"
99
+ end
100
+ end
101
+
80
102
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2009 Opscode, Inc
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -135,4 +136,23 @@ describe Chef::Resource::Mount do
135
136
  @resource.supports.should == support_hash
136
137
  end
137
138
 
139
+ describe "when it has mount point, device type, and fstype" do
140
+ before do
141
+ @resource.device("charmander")
142
+ @resource.mount_point("123.456")
143
+ @resource.device_type(:device)
144
+ @resource.fstype("ranked")
145
+ end
146
+
147
+ it "describes its state" do
148
+ state = @resource.state
149
+ state[:mount_point].should == "123.456"
150
+ state[:device_type].should eql(:device)
151
+ state[:fstype].should == "ranked"
152
+ end
153
+
154
+ it "returns the device as its identity" do
155
+ @resource.identity.should == "charmander"
156
+ end
157
+ end
138
158
  end
@@ -41,4 +41,22 @@ describe Chef::Resource::Ohai do
41
41
  @resource.plugin "passwd"
42
42
  @resource.plugin.should eql("passwd")
43
43
  end
44
+
45
+ describe "when it has a plugin value" do
46
+ before do
47
+ @resource.name("test")
48
+ @resource.plugin("passwd")
49
+ end
50
+
51
+ it "describes its state" do
52
+ state = @resource.state
53
+ state[:plugin].should == "passwd"
54
+ end
55
+
56
+ it "returns the name as its identity" do
57
+ @resource.identity.should == "test"
58
+ end
59
+ end
60
+
61
+
44
62
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -62,11 +63,13 @@ describe Chef::Resource::Package do
62
63
  before do
63
64
  @resource.package_name("tomcat")
64
65
  @resource.version("10.9.8")
66
+ @resource.options("-al")
65
67
  end
66
68
 
67
69
  it "describes its state" do
68
70
  state = @resource.state
69
71
  state[:version].should == "10.9.8"
72
+ state[:options].should == "-al"
70
73
  end
71
74
 
72
75
  it "returns the file path as its identity" do
@@ -72,4 +72,26 @@ describe Chef::Resource::RemoteDirectory do
72
72
  @resource.files_owner 1000
73
73
  @resource.files_owner.should eql(1000)
74
74
  end
75
+
76
+ describe "when it has cookbook, files owner, files mode, and source" do
77
+ before do
78
+ @resource.path("/var/path/")
79
+ @resource.cookbook("pokemon.rb")
80
+ @resource.files_owner("root")
81
+ @resource.files_group("supergroup")
82
+ @resource.files_mode("0664")
83
+ @resource.source("/var/source/")
84
+ end
85
+
86
+ it "describes its state" do
87
+ state = @resource.state
88
+ state[:files_owner].should == "root"
89
+ state[:files_group].should == "supergroup"
90
+ state[:files_mode].should == "0664"
91
+ end
92
+
93
+ it "returns the path as its identity" do
94
+ @resource.identity.should == "/var/path/"
95
+ end
96
+ end
75
97
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -82,4 +83,43 @@ describe Chef::Resource::RemoteFile do
82
83
  end
83
84
  end
84
85
 
86
+ describe "when it has group, mode, owner, source, and checksum" do
87
+ before do
88
+ if Chef::Platform.windows?
89
+ @resource.path("C:/temp/origin/file.txt")
90
+ @resource.rights(:read, "Everyone")
91
+ @resource.deny_rights(:full_control, "Clumsy_Sam")
92
+ else
93
+ @resource.path("/this/path/")
94
+ @resource.group("pokemon")
95
+ @resource.mode("0664")
96
+ @resource.owner("root")
97
+ end
98
+ @resource.source("https://www.google.com/images/srpr/logo3w.png")
99
+ @resource.checksum("1"*26)
100
+ end
101
+
102
+ it "describes its state" do
103
+ state = @resource.state
104
+ if Chef::Platform.windows?
105
+ puts state
106
+ state[:rights].should == [{:permissions => :read, :principals => "Everyone"}]
107
+ state[:deny_rights].should == [{:permissions => :full_control, :principals => "Clumsy_Sam"}]
108
+ else
109
+ state[:group].should == "pokemon"
110
+ state[:mode].should == "0664"
111
+ state[:owner].should == "root"
112
+ state[:checksum].should == "1"*26
113
+ end
114
+ end
115
+
116
+ it "returns the path as its identity" do
117
+ if Chef::Platform.windows?
118
+ @resource.identity.should == "C:/temp/origin/file.txt"
119
+ else
120
+ @resource.identity.should == "/this/path/"
121
+ end
122
+ end
123
+ end
124
+
85
125
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Bryan McLellan (btm@loftninjas.org)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Bryan McLellan
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -85,4 +86,22 @@ describe Chef::Resource::Route do
85
86
  lambda { @resource.route_type "lolcat" }.should raise_error(ArgumentError)
86
87
  end
87
88
 
89
+ describe "when it has netmask, gateway, and device" do
90
+ before do
91
+ @resource.target("charmander")
92
+ @resource.netmask("lemask")
93
+ @resource.gateway("111.111.111")
94
+ @resource.device("forcefield")
95
+ end
96
+
97
+ it "describes its state" do
98
+ state = @resource.state
99
+ state[:netmask].should == "lemask"
100
+ state[:gateway].should == "111.111.111"
101
+ end
102
+
103
+ it "returns the target as its identity" do
104
+ @resource.identity.should == "charmander"
105
+ end
106
+ end
88
107
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: AJ Christensen (<aj@opscode.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -43,4 +44,14 @@ describe Chef::Resource::RubyBlock do
43
44
  end.call.should eql("foo")
44
45
  end
45
46
 
47
+ describe "when it has been initialized with block code" do
48
+ before do
49
+ @resource.block_name("puts 'harrrr'")
50
+ end
51
+
52
+ it "returns the block as its identity" do
53
+ @resource.identity.should == "puts 'harrrr'"
54
+ end
55
+ end
56
+
46
57
  end
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # Author:: Daniel DeLeo (<dan@kallistec.com>)
3
+ # Author:: Tyler Cloke (<tyler@opscode.com>)
3
4
  # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
@@ -136,4 +137,23 @@ describe Chef::Resource::Scm do
136
137
  @resource.ssh_wrapper.should be_nil
137
138
  end
138
139
 
140
+ describe "when it has repository, revision, user, and group" do
141
+ before do
142
+ @resource.destination("hell")
143
+ @resource.repository("apt")
144
+ @resource.revision("1.2.3")
145
+ @resource.user("root")
146
+ @resource.group("super_adventure_club")
147
+ end
148
+
149
+ it "describes its state" do
150
+ state = @resource.state
151
+ state[:revision].should == "1.2.3"
152
+ end
153
+
154
+ it "returns the destination as its identity" do
155
+ @resource.identity.should == "hell"
156
+ end
157
+ end
158
+
139
159
  end