Sha256: 0e24df466cd292463d10dfa721fc49fb827e5f8695c920896b040e1b5ae6547d

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

require 'spec_helper'

include SpecInfra::Helper::RedHat
include SpecInfra::Helper::Exec

describe 'configurations are not set' do
  context file('/etc/passwd') do
    it { should be_file }
    its(:command) { should eq 'test -f /etc/passwd' }
  end
end

describe 'path is set' do
  let(:path) { '/sbin:/usr/sbin' }
  context file('/etc/passwd') do
    it { should be_file }
    its(:command) { should eq 'env PATH=/sbin:/usr/sbin:$PATH test -f /etc/passwd' }
  end
end

describe 'pre_command is set' do
  let(:pre_command) { 'source ~/.zshrc' }
  context file('/etc/passwd') do
    it { should be_file }
    its(:command) { should eq 'source ~/.zshrc && test -f /etc/passwd' }
  end
end

describe 'path and pre_command are set' do
  let(:path) { '/sbin:/usr/sbin' }
  let(:pre_command) { 'source ~/.zshrc' }
  context file('/etc/passwd') do
    it { should be_file }
    its(:command) { should eq 'env PATH=/sbin:/usr/sbin:$PATH source ~/.zshrc && env PATH=/sbin:/usr/sbin:$PATH test -f /etc/passwd' }
  end
end

describe 'path is set for check_selinux' do
  let(:path) { '/sbin:/usr/sbin' }
  context selinux do
    it { should be_disabled }
    its(:command) { should eq "env PATH=/sbin:/usr/sbin:$PATH test ! -f /etc/selinux/config || (env PATH=/sbin:/usr/sbin:$PATH getenforce | grep -i -- disabled && env PATH=/sbin:/usr/sbin:$PATH grep -i -- ^SELINUX=disabled$ /etc/selinux/config)" }
  end

  context selinux do
    it { should be_enforcing }
    its(:command) { should eq "env PATH=/sbin:/usr/sbin:$PATH getenforce | grep -i -- enforcing && env PATH=/sbin:/usr/sbin:$PATH grep -i -- ^SELINUX=enforcing$ /etc/selinux/config" }
  end

  context selinux do
    it { should be_permissive }
    its(:command) { should eq "env PATH=/sbin:/usr/sbin:$PATH getenforce | grep -i -- permissive && env PATH=/sbin:/usr/sbin:$PATH grep -i -- ^SELINUX=permissive$ /etc/selinux/config" }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
serverspec-0.12.0 spec/backend/exec/configuration_spec.rb