spec/gentoo/commands_spec.rb in serverspec-0.2.26 vs spec/gentoo/commands_spec.rb in serverspec-0.2.27
- old
+ new
@@ -221,5 +221,22 @@
describe 'get_mode', :os => :gentoo do
subject { commands.get_mode('/dev') }
it { should eq 'stat -c %a /dev' }
end
+
+describe 'check_access_by_user', :os => :gentoo do
+ context 'read access' do
+ subject {commands.check_access_by_user '/tmp/something', 'dummyuser1', 'r'}
+ it { should eq 'runuser -s /bin/sh -c "test -r /tmp/something" dummyuser1' }
+ end
+
+ context 'write access' do
+ subject {commands.check_access_by_user '/tmp/somethingw', 'dummyuser2', 'w'}
+ it { should eq 'runuser -s /bin/sh -c "test -w /tmp/somethingw" dummyuser2' }
+ end
+
+ context 'execute access' do
+ subject {commands.check_access_by_user '/tmp/somethingx', 'dummyuser3', 'x'}
+ it { should eq 'runuser -s /bin/sh -c "test -x /tmp/somethingx" dummyuser3' }
+ end
+end