Skip to content

Commit

Permalink
test: add tests for stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
jleeothon committed Mar 22, 2019
1 parent d4c38c5 commit d7d3ab6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/eksek_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@
end
end

RSpec.describe 'Standard input' do
it 'can write to a custom IO object' do
readable, writable = IO.pipe
Eksekuter.new.run('printf Hello', out: writable)
writable.close
expect(readable.read).to eq('Hello')
end

it 'can read from a custom IO object' do
readable, writable = IO.pipe
writable.write 'Hello'
writable.close
result = Eksekuter.new.run('read A; printf $A', in: readable, capture: true)
expect(result.stdout).to eq('Hello')
end
end

RSpec.describe 'Kernel#spawn-style parameters' do
it 'accepts a Hash as an optional first parameter' do
result = Eksekuter.new
Expand Down

0 comments on commit d7d3ab6

Please sign in to comment.