summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2011-03-09 16:00:17 -0800
committerJesse Wolfe <jes5199@gmail.com>2011-03-09 16:13:03 -0800
commitcd5deda8f9eefbe55c63c97c81293d01ca05c110 (patch)
treec40842bec611bfc87b6e8660881a20191628ef78
parent4bd54939ceb4c588b1633117d88472fe48e9dfdf (diff)
downloadpuppet-cd5deda8f9eefbe55c63c97c81293d01ca05c110.tar.gz
puppet-cd5deda8f9eefbe55c63c97c81293d01ca05c110.tar.xz
puppet-cd5deda8f9eefbe55c63c97c81293d01ca05c110.zip
(#2645) Adding a less-stubby test to verify the "system" attribute's behavior
Paired-with: Jacob Helwig <jacob@puppetlabs.com>
-rw-r--r--spec/unit/provider/user/user_role_add_spec.rb1
-rwxr-xr-xspec/unit/provider/user/useradd_spec.rb17
2 files changed, 13 insertions, 5 deletions
diff --git a/spec/unit/provider/user/user_role_add_spec.rb b/spec/unit/provider/user/user_role_add_spec.rb
index 9cf649267..f73942389 100644
--- a/spec/unit/provider/user/user_role_add_spec.rb
+++ b/spec/unit/provider/user/user_role_add_spec.rb
@@ -115,6 +115,7 @@ describe provider_class do
describe "when allow duplicate is enabled" do
before do
@resource.expects(:allowdupe?).returns true
+ @resource.stubs(:system?)
@provider.stubs(:is_role?).returns(false)
@provider.stubs(:execute)
@provider.expects(:execute).with { |args| args.include?("-o") }
diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb
index 81ad7d400..fd75c43f3 100755
--- a/spec/unit/provider/user/useradd_spec.rb
+++ b/spec/unit/provider/user/useradd_spec.rb
@@ -132,11 +132,6 @@ describe provider_class do
@provider.addcmd
end
- it "should check and add if it's a system user" do
- @provider.expects(:check_system_users).returns([])
- @provider.addcmd
- end
-
it "should check and add if home is managed" do
@provider.expects(:check_manage_home).returns([])
@provider.addcmd
@@ -147,6 +142,18 @@ describe provider_class do
@provider.addcmd
end
+ it "should return an array with -r if system? is true" do
+ resource = Puppet::Type.type(:user).new( :name => "bob", :system => true)
+
+ provider_class.new( resource ).addcmd.should include("-r")
+ end
+
+ it "should return an array without -r if system? is false" do
+ resource = Puppet::Type.type(:user).new( :name => "bob", :system => false)
+
+ provider_class.new( resource ).addcmd.should_not include("-r")
+ end
+
it "should return an array with full command" do
@provider.stubs(:command).with(:add).returns("useradd")
@provider.stubs(:add_properties).returns(["-G", "somegroup"])