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.5.1 test/unit/shellout_test.rb
ohloh_scm-2.4.14 test/unit/shellout_test.rb
ohloh_scm-2.4.13 test/unit/shellout_test.rb
ohloh_scm-2.4.12 test/unit/shellout_test.rb
ohloh_scm-2.4.11 test/unit/shellout_test.rb
ohloh_scm-2.4.10 test/unit/shellout_test.rb
ohloh_scm-2.4.9 test/unit/shellout_test.rb
ohloh_scm-2.4.8 test/unit/shellout_test.rb
ohloh_scm-2.4.7 test/unit/shellout_test.rb
ohloh_scm-2.4.6 test/unit/shellout_test.rb
ohloh_scm-2.4.5 test/unit/shellout_test.rb
ohloh_scm-2.4.4 test/unit/shellout_test.rb
ohloh_scm-2.4.3 test/unit/shellout_test.rb
ohloh_scm-2.4.1 test/unit/shellout_test.rb
ohloh_scm-2.4.0 test/unit/shellout_test.rb
ohloh_scm-2.3.5 test/unit/shellout_test.rb
ohloh_scm-2.3.4 test/unit/shellout_test.rb
ohloh_scm-2.3.2 test/unit/shellout_test.rb
ohloh_scm-2.3.1 test/unit/shellout_test.rb
ohloh_scm-2.3.0 test/unit/shellout_test.rb