Sha256: 56102d7ec207ad35dbbc66fff45d24ce98cd8ce6a8aa7146ae40b8b2585f1ff0

Contents?: true

Size: 891 Bytes

Versions: 6

Compression:

Stored size: 891 Bytes

Contents

require 'spec_helper_system'

describe "system_run:" do
  it "cat /etc/hosts" do
    system_run("cat /etc/hosts") do |r|
      r[:exit_code].should == 0
      r[:stdout].should =~ /localhost/
    end
  end

  it 'piping should be preserved' do
    system_run('rm -f /tmp/foo')
    system_run('echo "foo" > /tmp/foo') do |r|
      r[:stderr].should == ''
      r[:exit_code].should == 0
    end

    system_run('cat /tmp/foo') do |r|
      r[:stdout].should =~ /foo/
      r[:exit_code].should == 0
    end
    system_run('rm -f /tmp/foo')
  end

  it 'escape single quotes properly' do
    system_run('rm -f /tmp/foo')
    system_run("echo 'foo' > /tmp/foo") do |r|
      r[:stderr].should == ''
      r[:exit_code].should == 0
    end

    system_run('cat /tmp/foo') do |r|
      r[:stdout].should =~ /foo/
      r[:exit_code].should == 0
    end
    system_run('rm -f /tmp/foo')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rspec-system-1.1.0 spec/system/system_run_spec.rb
rspec-system-1.0.0 spec/system/system_run_spec.rb
rspec-system-0.3.6 spec/system/system_run_spec.rb
rspec-system-0.3.5 spec/system/system_run_spec.rb
rspec-system-0.3.4 spec/system/system_run_spec.rb
rspec-system-0.3.3 spec/system/system_run_spec.rb