spec/debian/commands_spec.rb in serverspec-0.2.26 vs spec/debian/commands_spec.rb in serverspec-0.2.27

- old
+ new

@@ -223,5 +223,22 @@ describe 'get_mode', :os => :debian do subject { commands.get_mode('/dev') } it { should eq 'stat -c %a /dev' } end + +describe 'check_access_by_user', :os => :debian 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