chef 10.28.2 → 10.30.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/lib/chef.rb +1 -0
  2. data/lib/chef/application/knife.rb +2 -0
  3. data/lib/chef/client.rb +1 -1
  4. data/lib/chef/config.rb +5 -1
  5. data/lib/chef/cookbook_uploader.rb +7 -14
  6. data/lib/chef/data_bag.rb +2 -3
  7. data/lib/chef/exceptions.rb +9 -1
  8. data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +4 -0
  9. data/lib/chef/knife.rb +3 -0
  10. data/lib/chef/mixin/deep_merge.rb +53 -21
  11. data/lib/chef/monkey_patches/net_http.rb +34 -0
  12. data/lib/chef/monkey_patches/uri.rb +70 -0
  13. data/lib/chef/node.rb +5 -5
  14. data/lib/chef/platform.rb +1 -0
  15. data/lib/chef/provider/cookbook_file.rb +14 -6
  16. data/lib/chef/provider/directory.rb +16 -10
  17. data/lib/chef/provider/file.rb +23 -17
  18. data/lib/chef/provider/group.rb +50 -31
  19. data/lib/chef/provider/group/dscl.rb +26 -4
  20. data/lib/chef/provider/group/gpasswd.rb +14 -19
  21. data/lib/chef/provider/group/groupadd.rb +41 -1
  22. data/lib/chef/provider/group/groupmod.rb +46 -36
  23. data/lib/chef/provider/group/pw.rb +59 -16
  24. data/lib/chef/provider/group/suse.rb +16 -13
  25. data/lib/chef/provider/group/usermod.rb +40 -18
  26. data/lib/chef/provider/group/windows.rb +13 -6
  27. data/lib/chef/provider/package/yum.rb +1 -0
  28. data/lib/chef/provider/remote_file.rb +8 -2
  29. data/lib/chef/provider/ruby_block.rb +1 -1
  30. data/lib/chef/provider/template.rb +11 -5
  31. data/lib/chef/provider/user/useradd.rb +9 -1
  32. data/lib/chef/provider/whyrun_safe_ruby_block.rb +30 -0
  33. data/lib/chef/providers.rb +1 -0
  34. data/lib/chef/resource/group.rb +11 -1
  35. data/lib/chef/resource/whyrun_safe_ruby_block.rb +31 -0
  36. data/lib/chef/resources.rb +1 -0
  37. data/lib/chef/rest.rb +6 -2
  38. data/lib/chef/rest/rest_request.rb +6 -2
  39. data/lib/chef/util/windows/net_group.rb +5 -1
  40. data/lib/chef/version.rb +1 -1
  41. data/spec/functional/resource/base.rb +40 -0
  42. data/spec/functional/resource/group_spec.rb +343 -0
  43. data/spec/spec_helper.rb +4 -0
  44. data/spec/support/platform_helpers.rb +17 -0
  45. data/spec/unit/client_spec.rb +1 -1
  46. data/spec/unit/data_bag_spec.rb +4 -6
  47. data/spec/unit/mixin/deep_merge_spec.rb +416 -190
  48. data/spec/unit/monkey_patches/uri_spec.rb +34 -0
  49. data/spec/unit/node/attribute_spec.rb +49 -14
  50. data/spec/unit/node_spec.rb +31 -0
  51. data/spec/unit/provider/file_spec.rb +27 -27
  52. data/spec/unit/provider/group/dscl_spec.rb +1 -0
  53. data/spec/unit/provider/group/gpasswd_spec.rb +16 -9
  54. data/spec/unit/provider/group/groupadd_spec.rb +3 -4
  55. data/spec/unit/provider/group/groupmod_spec.rb +0 -1
  56. data/spec/unit/provider/group/pw_spec.rb +12 -15
  57. data/spec/unit/provider/group/usermod_spec.rb +21 -6
  58. data/spec/unit/provider/group/windows_spec.rb +0 -8
  59. data/spec/unit/provider/group_spec.rb +26 -4
  60. data/spec/unit/provider/user/useradd_spec.rb +21 -0
  61. data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +47 -0
  62. data/spec/unit/rest_spec.rb +55 -22
  63. metadata +119 -44
  64. checksums.yaml +0 -7
@@ -0,0 +1,34 @@
1
+ #--
2
+ # Author:: Daniel DeLeo (<dan@opscode.com>)
3
+ # Copyright:: Copyright (c) 2013 Opscode, Inc.
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
+ describe URI do
21
+
22
+ describe "when a URI contains an IPv6 literal" do
23
+
24
+ let(:ipv6_uri) do
25
+ URI.parse("https://[2a00:1450:4009:809::1008]:8443")
26
+ end
27
+
28
+ it "returns the hostname without brackets" do
29
+ ipv6_uri.hostname.should == "2a00:1450:4009:809::1008"
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -7,9 +7,9 @@
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
8
8
  # you may not use this file except in compliance with the License.
9
9
  # You may obtain a copy of the License at
10
- #
10
+ #
11
11
  # http://www.apache.org/licenses/LICENSE-2.0
12
- #
12
+ #
13
13
  # Unless required by applicable law or agreed to in writing, software
14
14
  # distributed under the License is distributed on an "AS IS" BASIS,
15
15
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,9 +20,9 @@
20
20
  require 'spec_helper'
21
21
  require 'chef/node/attribute'
22
22
 
23
- describe Chef::Node::Attribute do
23
+ describe Chef::Node::Attribute do
24
24
  before(:each) do
25
- @attribute_hash =
25
+ @attribute_hash =
26
26
  {"dmi"=>{},
27
27
  "command"=>{"ps"=>"ps -ef"},
28
28
  "platform_version"=>"10.5.7",
@@ -193,7 +193,7 @@ describe Chef::Node::Attribute do
193
193
  @default_hash = {
194
194
  "domain" => "opscode.com",
195
195
  "hot" => { "day" => "saturday" },
196
- "music" => {
196
+ "music" => {
197
197
  "jimmy_eat_world" => "is fun!",
198
198
  "mastodon" => "rocks",
199
199
  "mars_volta" => "is loud and nutty",
@@ -225,7 +225,7 @@ describe Chef::Node::Attribute do
225
225
  [ :normal, :default, :override, :automatic ].each do |accessor|
226
226
  it "should set #{accessor}" do
227
227
  na = Chef::Node::Attribute.new({ :normal => true }, { :default => true }, { :override => true }, { :automatic => true })
228
- na.send(accessor).should == { accessor => true }
228
+ na.send(accessor).should == { accessor => true }
229
229
  end
230
230
  end
231
231
 
@@ -403,6 +403,21 @@ describe Chef::Node::Attribute do
403
403
  hash.class.should == Hash
404
404
  hash["day"].should == "sunday"
405
405
  end
406
+
407
+ # Regression test for CHEF-4631
408
+ context "when merging array values" do
409
+ before do
410
+ @default_attrs = {"foo" => {"bar" => ["default"]}}
411
+ @override_attrs = {"foo" => {"bar" => ["override"]}}
412
+
413
+ #(normal, default, override, automatic, state=[])
414
+ @attributes = Chef::Node::Attribute.new({ }, @default_attrs, @override_attrs, { })
415
+ end
416
+
417
+ it "should return the override" do
418
+ @attributes["foo"].to_hash["bar"].should == [ "override" ]
419
+ end
420
+ end
406
421
  end
407
422
 
408
423
  describe "has_key?" do
@@ -426,10 +441,10 @@ describe Chef::Node::Attribute do
426
441
  @attributes["music"]
427
442
  @attributes.has_key?("apophis").should == true
428
443
  end
429
-
444
+
430
445
  it "should find keys at the current nesting level" do
431
446
  @attributes["music"]
432
- @attributes.has_key?("mastodon").should == true
447
+ @attributes.has_key?("mastodon").should == true
433
448
  @attributes.has_key?("whitesnake").should == false
434
449
  end
435
450
 
@@ -443,7 +458,7 @@ describe Chef::Node::Attribute do
443
458
 
444
459
  [:include?, :key?, :member?].each do |method|
445
460
  it "should alias the method #{method} to itself" do
446
- @attributes.should respond_to(method)
461
+ @attributes.should respond_to(method)
447
462
  end
448
463
 
449
464
  it "#{method} should behave like has_key?" do
@@ -463,7 +478,7 @@ describe Chef::Node::Attribute do
463
478
 
464
479
  it "should be looking at the current position of the object" do
465
480
  @attributes["music"]
466
- @attributes.attribute?("mastodon").should == true
481
+ @attributes.attribute?("mastodon").should == true
467
482
  @attributes.attribute?("whitesnake").should == false
468
483
  end
469
484
  end
@@ -516,7 +531,7 @@ describe Chef::Node::Attribute do
516
531
  collect.include?("snakes").should == true
517
532
  collect.include?("snack").should == true
518
533
  collect.include?("place").should == true
519
- collect.length.should == 5
534
+ collect.length.should == 5
520
535
  end
521
536
 
522
537
  it "should yield lower if we go deeper" do
@@ -527,7 +542,7 @@ describe Chef::Node::Attribute do
527
542
  collect.include?("two").should == true
528
543
  collect.include?("four").should == true
529
544
  collect.include?("six").should == true
530
- collect.length.should == 3
545
+ collect.length.should == 3
531
546
  end
532
547
 
533
548
  it "should not raise an exception if one of the hashes has a nil value on a deep lookup" do
@@ -601,7 +616,7 @@ describe Chef::Node::Attribute do
601
616
  @attributes.each_key do |k|
602
617
  collect << k
603
618
  end
604
-
619
+
605
620
  collect.should include("one")
606
621
  collect.should include("snack")
607
622
  collect.should include("hut")
@@ -644,7 +659,7 @@ describe Chef::Node::Attribute do
644
659
  collect["snack"].should == "cookies"
645
660
  end
646
661
  end
647
-
662
+
648
663
  describe "each_value" do
649
664
  before do
650
665
  @attributes = Chef::Node::Attribute.new(
@@ -1027,7 +1042,27 @@ describe Chef::Node::Attribute do
1027
1042
  it "returns the automatic (highest precedence) value when deleting a key" do
1028
1043
  @attributes["foo"].delete("bar").should == "automatic_value"
1029
1044
  end
1045
+ end
1046
+
1047
+ describe "regression test for CHEF-4631" do
1048
+ before(:each) do
1049
+ @default_attrs = {"foo" => {"bar" => ["default"]}}
1050
+ @override_attrs = {"foo" => {"bar" => ["override"]}}
1051
+
1052
+ #(normal, default, override, automatic, state=[])
1053
+ @attributes = Chef::Node::Attribute.new({ }, @default_attrs, @override_attrs, { })
1054
+ end
1030
1055
 
1056
+ it "array values in the role default attributes should be concatanated to the nodes default attributes" do
1057
+ @default_attrs = {"foo" => {"bar" => ["1", "2"]}}
1058
+ @attributes = Chef::Node::Attribute.new({ }, @default_attrs, { }, { })
1059
+
1060
+ expansion = mock("Expansion", :default_attrs => { "foo" => {"bar" => ["3", "2"]}}, :override_attributes => { })
1061
+
1062
+ end
1063
+
1064
+ it "array values in the role override attributes should override the nodes default attributes" do
1065
+ end
1031
1066
  end
1032
1067
 
1033
1068
  end
@@ -741,4 +741,35 @@ describe Chef::Node do
741
741
 
742
742
  end
743
743
 
744
+ describe "regression test for CHEF-4631" do
745
+ before(:each) do
746
+ @node.stub!(:chef_environment).and_return("_default")
747
+ end
748
+
749
+ it "array values in the role default attributes should be concatanated to the nodes default attributes" do
750
+ @node.default_attrs = {"foo" => {"bar" => ["1", "2"]}}
751
+ expansion = mock("Expansion", :default_attrs => { "foo" => {"bar" => ["3", "2"]}}, :override_attrs => { })
752
+ @node.apply_expansion_attributes(expansion)
753
+ @node["foo"]["bar"].should == ["1", "2", "3", "2"]
754
+ @node["foo"].to_hash["bar"].should == ["1", "2", "3", "2"]
755
+ end
756
+
757
+ it "array values in the role override attributes should override the nodes default attributes" do
758
+ @node.default_attrs = {"foo" => {"bar" => ["1", "2"]}}
759
+ expansion = mock("Expansion", :default_attrs => { "foo" => {"bar" => ["3", "2"]}}, :override_attrs => { "foo" => {"bar" => ["5"] } })
760
+ @node.apply_expansion_attributes(expansion)
761
+ @node["foo"]["bar"].should == ["5"]
762
+ @node["foo"].to_hash["bar"].should == ["5"]
763
+ end
764
+
765
+ it "array values in the role override attributes should merge with the nodes override attributes" do
766
+ @node.default_attrs = {"foo" => {"bar" => ["1", "2"]}}
767
+ @node.override_attrs = {"foo" => {"bar" => ["5", "0"]}}
768
+ expansion = mock("Expansion", :default_attrs => { "foo" => {"bar" => ["3", "2"]}}, :override_attrs => { "foo" => {"bar" => ["5"] } })
769
+ @node.apply_expansion_attributes(expansion)
770
+ @node["foo"]["bar"].should == ["5", "0", "5"]
771
+ @node["foo"].to_hash["bar"].should == ["5", "0", "5"]
772
+ end
773
+ end
774
+
744
775
  end
@@ -56,68 +56,68 @@ describe Chef::Provider::File do
56
56
  context "load_current_resource_attrs", :unix_only do
57
57
  it "should collect the current state of the file on the filesystem and populate current_resource" do
58
58
  # test setup
59
- stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
60
- ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
61
-
62
- # test execution
59
+ stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
60
+ ::File.should_receive(:stat).exactly(2).with(@resource.path).and_return(stat_struct)
61
+
62
+ # test execution
63
63
  @provider.load_current_resource
64
-
64
+
65
65
  # post-condition checks
66
66
  @provider.current_resource.mode.should == 0600
67
67
  @provider.current_resource.owner.should == 0
68
68
  @provider.current_resource.group.should == 0
69
69
  end
70
-
70
+
71
71
  it "should NOT update the new_resource state with the current_resourse state if new_resource state is already specified" do
72
72
  # test setup
73
- stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
74
- ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
75
-
73
+ stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
74
+ ::File.should_receive(:stat).exactly(2).with(@resource.path).and_return(stat_struct)
75
+
76
76
  @provider.new_resource.group(1)
77
77
  @provider.new_resource.owner(1)
78
78
  @provider.new_resource.mode(0644)
79
-
80
- # test execution
79
+
80
+ # test execution
81
81
  @provider.load_current_resource
82
-
82
+
83
83
  # post-condition checks
84
84
  @provider.new_resource.group.should == 1
85
85
  @provider.new_resource.owner.should == 1
86
86
  @provider.new_resource.mode.should == 0644
87
87
  end
88
-
88
+
89
89
  it "should update the new_resource state with the current_resource state if the new_resource state is not specified." do
90
90
  # test setup
91
- stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
92
- ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
93
-
91
+ stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
92
+ ::File.should_receive(:stat).exactly(2).with(@resource.path).and_return(stat_struct)
93
+
94
94
  @provider.new_resource.group(nil)
95
95
  @provider.new_resource.owner(nil)
96
96
  @provider.new_resource.mode(nil)
97
-
98
- # test execution
97
+
98
+ # test execution
99
99
  @provider.load_current_resource
100
-
100
+
101
101
  # post-condition checks
102
102
  @provider.new_resource.group.should eql(@provider.current_resource.group)
103
103
  @provider.new_resource.owner.should eql(@provider.current_resource.owner)
104
104
  @provider.new_resource.mode.should eql(@provider.current_resource.mode)
105
105
  end
106
-
106
+
107
107
  it "should update the new_resource when attempting to set the new state" do
108
108
  # test setup
109
- stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
109
+ stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
110
110
  # called once in update_new_file_state and once in checksum
111
- ::File.should_receive(:stat).twice.with(@provider.new_resource.path).and_return(stat_struct)
111
+ ::File.should_receive(:stat).twice.with(@provider.new_resource.path).and_return(stat_struct)
112
112
  ::File.should_receive(:directory?).once.with(@provider.new_resource.path).and_return(false)
113
-
113
+
114
114
  @provider.new_resource.group(nil)
115
115
  @provider.new_resource.owner(nil)
116
116
  @provider.new_resource.mode(nil)
117
-
118
- # test exectution
117
+
118
+ # test exectution
119
119
  @provider.update_new_file_state
120
-
120
+
121
121
  # post-condition checks
122
122
  @provider.new_resource.group.should == 0
123
123
  @provider.new_resource.owner.should == 0
@@ -487,7 +487,7 @@ describe Chef::Provider::File do
487
487
  it "should return valid diff output when content does not match the string content provided" do
488
488
  Tempfile.open("some-temp") do |file|
489
489
  @resource.path file.path
490
- @provider = Chef::Provider::File.new(@resource, @run_context)
490
+ @provider = Chef::Provider::File.new(@resource, @run_context)
491
491
  @provider.load_current_resource
492
492
  result = @provider.diff_current_from_content "foo baz"
493
493
  # remove the file name info which varies.
@@ -265,6 +265,7 @@ describe Chef::Provider::Group::Dscl do
265
265
  it "should manage the group_name if it changed and the new resources group_name is not null" do
266
266
  @current_resource.group_name("oldval")
267
267
  @new_resource.group_name("newname")
268
+ @provider.should_receive(:set_members).and_return(true)
268
269
  @provider.should_receive(:safe_dscl).with("create /Groups/newname")
269
270
  @provider.should_receive(:safe_dscl).with("create /Groups/newname Password '*'")
270
271
  @provider.manage_group
@@ -76,8 +76,7 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do
76
76
  @new_resource.members([])
77
77
  end
78
78
 
79
- it "logs a message and does not modify group membership" do
80
- Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members to add")
79
+ it "does not modify group membership" do
81
80
  @provider.should_not_receive(:shell_out!)
82
81
  @provider.modify_group_members
83
82
  end
@@ -85,7 +84,7 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do
85
84
 
86
85
  describe "when the resource specifies group members" do
87
86
  it "should log an appropriate debug message" do
88
- Chef::Log.should_receive(:debug).with("group[wheel] setting group members to lobster, rage, fist")
87
+ Chef::Log.should_receive(:debug).with("group[wheel] setting group members to: lobster, rage, fist")
89
88
  @provider.stub!(:shell_out!)
90
89
  @provider.modify_group_members
91
90
  end
@@ -95,12 +94,20 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do
95
94
  @provider.modify_group_members
96
95
  end
97
96
 
98
- it "should run gpasswd individually for each user when the append option is set" do
99
- @new_resource.append(true)
100
- @provider.should_receive(:shell_out!).with("gpasswd -a lobster wheel")
101
- @provider.should_receive(:shell_out!).with("gpasswd -a rage wheel")
102
- @provider.should_receive(:shell_out!).with("gpasswd -a fist wheel")
103
- @provider.modify_group_members
97
+ describe "when no user exists in the system" do
98
+ before do
99
+ current_resource = @new_resource.dup
100
+ current_resource.members([ ])
101
+ @provider.current_resource = current_resource
102
+ end
103
+
104
+ it "should run gpasswd individually for each user when the append option is set" do
105
+ @new_resource.append(true)
106
+ @provider.should_receive(:shell_out!).with("gpasswd -a lobster wheel")
107
+ @provider.should_receive(:shell_out!).with("gpasswd -a rage wheel")
108
+ @provider.should_receive(:shell_out!).with("gpasswd -a fist wheel")
109
+ @provider.modify_group_members
110
+ end
104
111
  end
105
112
 
106
113
  end
@@ -129,10 +129,9 @@ describe Chef::Provider::Group::Groupadd do
129
129
  end
130
130
  end
131
131
 
132
- describe "modify_group_members" do
133
-
134
- it "should raise an error when calling modify_group_members" do
135
- lambda { @provider.modify_group_members }.should raise_error(Chef::Exceptions::Group, "you must override modify_group_members in #{@provider.to_s}")
132
+ [:add_member, :remove_member, :set_members].each do |m|
133
+ it "should raise an error when calling #{m}" do
134
+ lambda { @provider.send(m, [ ]) }.should raise_error(Chef::Exceptions::Group, "you must override #{m} in #{@provider.to_s}")
136
135
  end
137
136
  end
138
137
 
@@ -62,7 +62,6 @@ describe Chef::Provider::Group::Groupmod do
62
62
 
63
63
  it "logs a message and sets group's members to 'none', then removes existing group members" do
64
64
  Chef::Log.should_receive(:debug).with("group[wheel] setting group members to: none")
65
- Chef::Log.should_receive(:debug).with("group[wheel] removing members lobster, rage, fist")
66
65
  @provider.should_receive(:shell_out!).with("group mod -n wheel_bak wheel")
67
66
  @provider.should_receive(:shell_out!).with("group add -g '123' -o wheel")
68
67
  @provider.should_receive(:shell_out!).with("group del wheel_bak")
@@ -49,7 +49,7 @@ describe Chef::Provider::Group::Pw do
49
49
  describe "when creating a group" do
50
50
  it "should run pw groupadd with the return of set_options and set_members_option" do
51
51
  @new_resource.gid(23)
52
- @provider.should_receive(:run_command).with({ :command => "pw groupadd wheel -g '23' -M root,aj" }).and_return(true)
52
+ @provider.should_receive(:run_command).with({ :command => "pw groupadd wheel -g '23'" }).and_return(true)
53
53
  @provider.create_group
54
54
  end
55
55
  end
@@ -58,7 +58,9 @@ describe Chef::Provider::Group::Pw do
58
58
 
59
59
  it "should run pw groupmod with the return of set_options" do
60
60
  @new_resource.gid(42)
61
- @provider.should_receive(:run_command).with({ :command => "pw groupmod wheel -g '42' -M root,aj" }).and_return(true)
61
+ @new_resource.members(["someone"])
62
+ @provider.should_receive(:run_command).with({ :command => "pw groupmod wheel -g '42' -m someone" }).and_return(true)
63
+ @provider.should_receive(:run_command).with({ :command => "pw groupmod wheel -g '42' -d root,aj" }).and_return(true)
62
64
  @provider.manage_group
63
65
  end
64
66
 
@@ -78,14 +80,9 @@ describe Chef::Provider::Group::Pw do
78
80
  @new_resource.stub!(:members).and_return([])
79
81
  @current_resource.stub!(:members).and_return([])
80
82
  end
81
-
82
- it "should log an appropriate message" do
83
- Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members")
84
- @provider.set_members_option
85
- end
86
-
83
+
87
84
  it "should set no options" do
88
- @provider.set_members_option.should eql("")
85
+ @provider.set_members_options.should eql([ ])
89
86
  end
90
87
  end
91
88
 
@@ -96,12 +93,12 @@ describe Chef::Provider::Group::Pw do
96
93
  end
97
94
 
98
95
  it "should log an appropriate message" do
99
- Chef::Log.should_receive(:debug).with("group[wheel] removing group members all, your, base")
100
- @provider.set_members_option
96
+ Chef::Log.should_receive(:debug).with("group[wheel] removing group members: all,your,base")
97
+ @provider.set_members_options
101
98
  end
102
99
 
103
100
  it "should set the -d option with the members joined by ','" do
104
- @provider.set_members_option.should eql(" -d all,your,base")
101
+ @provider.set_members_options.should eql([ " -d all,your,base" ])
105
102
  end
106
103
  end
107
104
 
@@ -112,12 +109,12 @@ describe Chef::Provider::Group::Pw do
112
109
  end
113
110
 
114
111
  it "should log an appropriate debug message" do
115
- Chef::Log.should_receive(:debug).with("group[wheel] setting group members to all, your, base")
116
- @provider.set_members_option
112
+ Chef::Log.should_receive(:debug).with("group[wheel] adding group members: all,your,base")
113
+ @provider.set_members_options
117
114
  end
118
115
 
119
116
  it "should set the -M option with the members joined by ','" do
120
- @provider.set_members_option.should eql(" -M all,your,base")
117
+ @provider.set_members_options.should eql([ " -m all,your,base" ])
121
118
  end
122
119
  end
123
120
  end