spec/sprinkle/verify_spec.rb in sprinkle-0.3.6 vs spec/sprinkle/verify_spec.rb in sprinkle-0.4.0
- old
+ new
@@ -12,10 +12,22 @@
# Check that a file contains a substring
file_contains 'my_file.txt', 'A sunny day on the lower east-side'
# Check a directory exists
has_directory 'mydir'
+
+ # Check for a user
+ has_user "bob"
+
+ # Check for user with old API
+ user_present "someuser"
+
+ # Check for user in a group
+ has_user "alf", :in_group => "alien"
+
+ # Check for a group
+ has_group "bobgroup"
# Check a symlink exists
has_symlink 'mypointer'
# Check a symlink points to a certain file
@@ -62,11 +74,27 @@
end
it 'should do a "test -d" on the has_directory check' do
@verification.commands.should include('test -d mydir')
end
+
+ it 'should use id to check for user in group' do
+ @verification.commands.should include("id -G alf | xargs -n1 echo | grep alien")
+ end
+
+ it 'should use id to check for user' do
+ @verification.commands.should include('id bob')
+ end
+
+ it 'should use id to check for user via user_present' do
+ @verification.commands.should include('id someuser')
+ end
+ it 'should use id to check for group' do
+ @verification.commands.should include('id -g bobgroup')
+ end
+
it 'should do a "test -L" to check something is a symbolic link' do
@verification.commands.should include('test -L mypointer')
end
it 'should do a test equality to check a symlink points to a specific file' do
@@ -88,10 +116,10 @@
it 'should check if ruby can include a, b, c' do
@verification.commands.should include("ruby -e \"require 'rubygems';require 'a';require 'b';require 'c'\"")
end
it 'should check that a ruby gem is installed' do
- @verification.commands.should include("sudo gem list 'rails' --installed --version '2.1.0' > /dev/null")
+ @verification.commands.should include("gem list 'rails' --installed --version '2.1.0' > /dev/null")
end
it 'should check that an RPM is installed' do
@verification.commands.should include("rpm -qa | grep ntp")
end