Sha256: 83a4278a8fa92d055ae6bf65f8db8e359e30f34a020e89ac8766475054ee2744

Contents?: true

Size: 742 Bytes

Versions: 2

Compression:

Stored size: 742 Bytes

Contents

require_relative '../test_helper'

class ShelloutTest < OhlohScm::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

2 entries across 2 versions & 1 rubygems

Version Path
ohloh_scm-2.1.0 test/unit/shellout_test.rb
ohloh_scm-2.0.1 test/unit/shellout_test.rb