Sha256: 6a1bd2d33cde367c069d51571f34407ef09ade51c1a77f83158d485b1e297002

Contents?: true

Size: 760 Bytes

Versions: 34

Compression:

Stored size: 760 Bytes

Contents

require_relative '../test_helper'
require 'timeout'

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

34 entries across 34 versions & 1 rubygems

Version Path
ohloh_scm-2.2.13 test/unit/shellout_test.rb
ohloh_scm-2.2.12 test/unit/shellout_test.rb
ohloh_scm-2.2.11 test/unit/shellout_test.rb
ohloh_scm-2.2.10 test/unit/shellout_test.rb
ohloh_scm-2.2.9 test/unit/shellout_test.rb
ohloh_scm-2.2.8 test/unit/shellout_test.rb
ohloh_scm-2.2.7 test/unit/shellout_test.rb
ohloh_scm-2.2.6 test/unit/shellout_test.rb
ohloh_scm-2.2.5 test/unit/shellout_test.rb
ohloh_scm-2.2.4 test/unit/shellout_test.rb
ohloh_scm-2.2.3 test/unit/shellout_test.rb
ohloh_scm-2.2.2 test/unit/shellout_test.rb
ohloh_scm-2.2.1 test/unit/shellout_test.rb
ohloh_scm-2.2.0 test/unit/shellout_test.rb