Sha256: 7071f49187e669d5e6439a725f5409a9367653d95600db07d7d27ab89884f126

Contents?: true

Size: 1.17 KB

Versions: 41

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

include Serverspec::Helper::Exec

describe 'build command with path' do
  before :each do
    RSpec.configure do |c|
      c.path = '/sbin:/usr/sbin'
    end
  end

  context 'command pattern 1' do
    subject { backend.build_command('test -f /etc/passwd') }
    it { should eq 'env PATH=/sbin:/usr/sbin:$PATH test -f /etc/passwd' }
  end

  context 'command pattern 2' do
    subject { backend.build_command('test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)') }
      it { 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 'command pattern 3' do
    subject { backend.build_command("dpkg -s apache2 && ! dpkg -s apache2 | grep -E '^Status: .+ not-installed$'") }
    it { should eq "env PATH=/sbin:/usr/sbin:$PATH dpkg -s apache2 && ! env PATH=/sbin:/usr/sbin:$PATH dpkg -s apache2 | grep -E '^Status: .+ not-installed$'" }
  end

  after :each do
    RSpec.configure do |c|
      c.path = nil
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
serverspec-0.9.8 spec/backend/exec/build_command_spec.rb
serverspec-0.9.7 spec/backend/exec/build_command_spec.rb
serverspec-0.9.6 spec/backend/exec/build_command_spec.rb
serverspec-0.9.5 spec/backend/exec/build_command_spec.rb
serverspec-0.9.4 spec/backend/exec/build_command_spec.rb
serverspec-0.9.3 spec/backend/exec/build_command_spec.rb
serverspec-0.9.2 spec/backend/exec/build_command_spec.rb
serverspec-0.9.1 spec/backend/exec/build_command_spec.rb
serverspec-0.9.0 spec/backend/exec/build_command_spec.rb
serverspec-0.8.1 spec/backend/exec/build_command_spec.rb
serverspec-0.8.0 spec/backend/exec/build_command_spec.rb
serverspec-0.7.13 spec/backend/exec/build_command_spec.rb
serverspec-0.7.12 spec/backend/exec/build_command_spec.rb
serverspec-0.7.11 spec/backend/exec/build_command_spec.rb
serverspec-0.7.10 spec/backend/exec/build_command_spec.rb
serverspec-0.7.9 spec/backend/exec/build_command_spec.rb
serverspec-0.7.8 spec/backend/exec/build_command_spec.rb
serverspec-0.7.7 spec/backend/exec/build_command_spec.rb
serverspec-0.7.6 spec/backend/exec/build_command_spec.rb
serverspec-0.7.5 spec/backend/exec/build_command_spec.rb