Sha256: 94ccbf73389cadd8092bb5838530c8d1dd2e03574466359d09655b5e30ca4a16

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

require_relative '../test_helper'

class ShelloutTest < Scm::Test
  def test_execute_must_pipe_the_results_accurately
    status, out, err = Shellout.execute("ruby -e 'puts %[hello world]; STDERR.puts(%[some error])'")

    assert_equal out, "hello world\n"
    assert_equal err, "some error\n"
    assert_equal status.success?, true
  end

  def test_execute_must_return_appropriate_status_for_a_failed_process
    status, out, err = Shellout.execute("ruby -e 'exit(1)'")

    assert_equal status.success?, false
  end

  def test_execute_must_not_hang_when_io_buffer_is_full
    assert_nothing_raised do
      Timeout::timeout(1) do
        Shellout.execute("ruby -e 'STDERR.puts(%[some line\n] * 10000)'")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ohloh_scm-2.0.0 test/unit/shellout_test.rb