spec/solaris/commands_spec.rb in serverspec-0.2.16 vs spec/solaris/commands_spec.rb in serverspec-0.2.17
- old
+ new
@@ -56,26 +56,26 @@
end
describe 'check_file_contain_within', :os => :solaris do
context 'contain a pattern in the file' do
subject { commands.check_file_contain_within('Gemfile', 'rspec') }
- it { should eq "sed -n '1,$p' Gemfile | grep -q 'rspec' -" }
+ it { should eq "sed -n '1,$p' Gemfile | grep -q 'rspec' /dev/stdin" }
end
context 'contain a pattern after a line in a file' do
subject { commands.check_file_contain_within('Gemfile', 'rspec', '/^group :test do/') }
- it { should eq "sed -n '/^group :test do/,$p' Gemfile | grep -q 'rspec' -" }
+ it { should eq "sed -n '/^group :test do/,$p' Gemfile | grep -q 'rspec' /dev/stdin" }
end
context 'contain a pattern before a line in a file' do
subject {commands.check_file_contain_within('Gemfile', 'rspec', nil, '/^end/') }
- it { should eq "sed -n '1,/^end/p' Gemfile | grep -q 'rspec' -" }
+ it { should eq "sed -n '1,/^end/p' Gemfile | grep -q 'rspec' /dev/stdin" }
end
context 'contain a pattern from within a line and another line in a file' do
subject { commands.check_file_contain_within('Gemfile', 'rspec', '/^group :test do/', '/^end/') }
- it { should eq "sed -n '/^group :test do/,/^end/p' Gemfile | grep -q 'rspec' -" }
+ it { should eq "sed -n '/^group :test do/,/^end/p' Gemfile | grep -q 'rspec' /dev/stdin" }
end
end
describe 'check_mode', :os => :solaris do
subject { commands.check_mode('/etc/sudoers', 440) }
@@ -107,12 +107,31 @@
it { should eq 'gem list --local | grep \'^jekyll \'' }
end
describe 'check_belonging_group', :os => :solaris do
subject { commands.check_belonging_group('root', 'wheel') }
- it { should eq "id root | awk '{print $3}' | grep wheel" }
+ it { should eq "id -Gn root | grep wheel" }
end
+describe 'have_gid', :os => :solaris do
+ subject { commands.check_gid('root', 0) }
+ it { should eq "getent group | grep -w ^root | cut -f 3 -d ':' | grep -w 0" }
+end
+
+describe 'have_uid', :os => :solaris do
+ subject { commands.check_uid('root', 0) }
+ it { should eq "id root | grep uid=0(" }
+end
+
+describe 'have_login_shell', :os => :solaris do
+ subject { commands.check_login_shell('root', '/bin/bash') }
+ it { should eq "grep -w ^root /etc/passwd | cut -f 7 -d ':' | grep -w /bin/bash" }
+end
+
+describe 'have_home_directory', :os => :solaris do
+ subject { commands.check_home_directory('root', '/root') }
+ it { should eq "grep -w ^root /etc/passwd | cut -f 6 -d ':' | grep -w /root" }
+end
describe 'check_zfs', :os => :solaris do
context 'check without properties' do
subject { commands.check_zfs('rpool') }
it { should eq "/sbin/zfs list -H rpool" }