spec/backend/exec/build_command_spec.rb in specinfra-2.0.0.beta32 vs spec/backend/exec/build_command_spec.rb in specinfra-2.0.0.beta33

- old
+ new

@@ -2,17 +2,17 @@ describe Specinfra::Backend::Exec do describe '#build_command' do context 'with simple command' do it 'should escape spaces' do - expect(Specinfra.backend.build_command('test -f /etc/passwd')).to eq '/bin/sh -c test\ -f\ /etc/passwd' + expect(Specinfra.backend.send(:build_command, 'test -f /etc/passwd')).to eq '/bin/sh -c test\ -f\ /etc/passwd' end end context 'with complex command' do it 'should escape special chars' do - expect(Specinfra.backend.build_command('test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)')).to eq '/bin/sh -c test\ \!\ -f\ /etc/selinux/config\ \|\|\ \(getenforce\ \|\ grep\ -i\ --\ disabled\ \&\&\ grep\ -i\ --\ \^SELINUX\=disabled\$\ /etc/selinux/config\)' + expect(Specinfra.backend.send(:build_command, 'test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)')).to eq '/bin/sh -c test\ \!\ -f\ /etc/selinux/config\ \|\|\ \(getenforce\ \|\ grep\ -i\ --\ disabled\ \&\&\ grep\ -i\ --\ \^SELINUX\=disabled\$\ /etc/selinux/config\)' end end context 'with custom shell' do before do @@ -22,11 +22,11 @@ after do RSpec.configure {|c| c.shell = nil } end it 'should use custom shell' do - expect(Specinfra.backend.build_command('test -f /etc/passwd')).to eq '/usr/local/bin/tcsh -c test\ -f\ /etc/passwd' + expect(Specinfra.backend.send(:build_command, 'test -f /etc/passwd')).to eq '/usr/local/bin/tcsh -c test\ -f\ /etc/passwd' end end context 'with custom shell that needs escaping' do before do @@ -36,11 +36,11 @@ after do RSpec.configure {|c| c.shell = nil } end it 'should use custom shell' do - expect(Specinfra.backend.build_command('test -f /etc/passwd')).to eq '/usr/test\ \&\ spec/bin/sh -c test\ -f\ /etc/passwd' + expect(Specinfra.backend.send(:build_command, 'test -f /etc/passwd')).to eq '/usr/test\ \&\ spec/bin/sh -c test\ -f\ /etc/passwd' end end context 'with custom path' do before do @@ -50,11 +50,11 @@ after do RSpec.configure {|c| c.path = nil } end it 'should use custom path' do - expect(Specinfra.backend.build_command('test -f /etc/passwd')).to eq 'env PATH="/opt/bin:/opt/foo/bin:$PATH" /bin/sh -c test\ -f\ /etc/passwd' + expect(Specinfra.backend.send(:build_command, 'test -f /etc/passwd')).to eq 'env PATH="/opt/bin:/opt/foo/bin:$PATH" /bin/sh -c test\ -f\ /etc/passwd' end end context 'with custom path that needs escaping' do before do @@ -64,10 +64,10 @@ after do RSpec.configure {|c| c.path = nil } end it 'should use custom path' do - expect(Specinfra.backend.build_command('test -f /etc/passwd')).to eq 'env PATH="/opt/bin:/opt/test & spec/bin:$PATH" /bin/sh -c test\ -f\ /etc/passwd' + expect(Specinfra.backend.send(:build_command, 'test -f /etc/passwd')).to eq 'env PATH="/opt/bin:/opt/test & spec/bin:$PATH" /bin/sh -c test\ -f\ /etc/passwd' end end end end