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.11.5 spec/backend/exec/build_command_spec.rb
serverspec-0.11.4 spec/backend/exec/build_command_spec.rb
serverspec-0.11.3 spec/backend/exec/build_command_spec.rb
serverspec-0.11.2 spec/backend/exec/build_command_spec.rb
serverspec-0.11.1 spec/backend/exec/build_command_spec.rb
serverspec-0.11.0 spec/backend/exec/build_command_spec.rb
serverspec-0.10.13 spec/backend/exec/build_command_spec.rb
serverspec-0.10.12 spec/backend/exec/build_command_spec.rb
serverspec-0.10.11 spec/backend/exec/build_command_spec.rb
serverspec-0.10.10 spec/backend/exec/build_command_spec.rb
serverspec-0.10.9 spec/backend/exec/build_command_spec.rb
serverspec-0.10.8 spec/backend/exec/build_command_spec.rb
serverspec-0.10.7 spec/backend/exec/build_command_spec.rb
serverspec-0.10.6 spec/backend/exec/build_command_spec.rb
serverspec-0.10.5 spec/backend/exec/build_command_spec.rb
serverspec-0.10.4 spec/backend/exec/build_command_spec.rb
serverspec-0.10.3 spec/backend/exec/build_command_spec.rb
serverspec-0.10.2 spec/backend/exec/build_command_spec.rb
serverspec-0.10.1 spec/backend/exec/build_command_spec.rb
serverspec-0.10.0 spec/backend/exec/build_command_spec.rb