require 'helper'

class TestCoreInitialization < Test::Unit::TestCase
  def test_spawn_with_file
    assert_nothing_raised { exp = Expectr.new(File.new("/bin/ls"), flush_buffer: false) }
  end

  def test_spawn_with_string
    assert_nothing_raised { exp = Expectr.new(File.new("/bin/ls"), flush_buffer: false) }
  end

  # lib/expectr.rb's permissions should be set to 0644
  def test_spawn_failures
    assert_raises(Errno::ENOENT) { exp = Expectr.new("lib/ThisFileShouldNotExist", flush_buffer: false) }
    assert_raises(Errno::EACCES) { exp = Expectr.new("lib/expectr.rb", flush_buffer: false) }
  end

  def test_spawn_from_child_interface
    assert_nothing_raised do
      expectr = Expectr::Child::spawn("/bin/ls", flush_buffer: false)
      assert_equal(expectr.class, Expectr)
    end
  end
end

require 'helper'

class TestCoreInitialization < Test::Unit::TestCase
  def test_spawn_with_file
    assert_nothing_raised { exp = Expectr.new(File.new("/bin/ls"), flush_buffer: false) }
  end

  def test_spawn_with_string
    assert_nothing_raised { exp = Expectr.new(File.new("/bin/ls"), flush_buffer: false) }
  end

  # lib/expectr.rb's permissions should be set to 0644
  def test_spawn_failures
    assert_raises(Errno::ENOENT) { exp = Expectr.new("lib/ThisFileShouldNotExist", flush_buffer: false) }
    assert_raises(Errno::EACCES) { exp = Expectr.new("lib/expectr.rb", flush_buffer: false) }
  end
end

Remove test for removed Child.spawn function
Remove test for removed Child.spawn function
