Skip to content

Commit a86c2a3

Browse files
authored
Merge pull request #624 from takumin/feat-system-user-group
feat: implemented `is_system_group?` and `is_system_user?`
2 parents feb6758 + 0cd1cb9 commit a86c2a3

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

lib/serverspec/type/group.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@ def gid
1111
def has_gid?(gid)
1212
@runner.check_group_has_gid(@name, gid)
1313
end
14+
15+
def is_system_group?
16+
@runner.check_group_is_system_group(@name)
17+
end
1418
end
1519
end

lib/serverspec/type/user.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,9 @@ def maximum_days_between_password_change
4343
def encrypted_password
4444
@runner.get_user_encrypted_password(@name).stdout.strip
4545
end
46+
47+
def is_system_user?
48+
@runner.check_user_is_system_user(@name)
49+
end
4650
end
4751
end

spec/type/base/group_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
its(:gid) { should == 0 }
1515
its(:gid) { should < 10 }
1616
end
17+
18+
describe group('root') do
19+
it { should be_is_system_group }
20+
end

spec/type/base/user_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
describe user('root') do
4848
its(:maximum_days_between_password_change) { should == 0 }
4949
end
50+
51+
describe user('root') do
52+
it { should be_is_system_user }
53+
end

0 commit comments

Comments
 (0)