Skip to content
This repository
Browse code

Basic Open3.popen3 specs

  • Loading branch information...
commit 973dffa92f3d6815c5acda3f7218ece8289175cb 1 parent 29d46fc
John Firebaugh jfirebaugh authored

Showing 1 changed file with 23 additions and 0 deletions. Show diff stats Hide diff stats

  1. +23 0 spec/ruby/library/open3/popen3_spec.rb
23 spec/ruby/library/open3/popen3_spec.rb
@@ -2,5 +2,28 @@
2 2 require 'open3'
3 3
4 4 describe "Open3.popen3" do
  5 + after :each do
  6 + [@in, @out, @err].each do |io|
  7 + io.close if io && !io.closed?
  8 + end
  9 + end
  10 +
  11 + it "executes a process with a pipe to read stdout" do
  12 + @in, @out, @err = Open3.popen3(ruby_cmd("print :foo"))
  13 + @out.read.should == "foo"
  14 + end
  15 +
  16 + it "executes a process with a pipe to read stderr" do
  17 + @in, @out, @err = Open3.popen3(ruby_cmd("STDERR.print :foo"))
  18 + @err.read.should == "foo"
  19 + end
  20 +
  21 + it "executes a process with a pipe to write stdin" do
  22 + @in, @out, @err = Open3.popen3(ruby_cmd("print STDIN.read"))
  23 + @in.write("foo")
  24 + @in.close
  25 + @out.read.should == "foo"
  26 + end
  27 +
5 28 it "needs to be reviewed for spec completeness"
6 29 end

0 comments on commit 973dffa

Please sign in to comment.
Something went wrong with that request. Please try again.