Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gem/terminalwire-server/lib/terminalwire/server/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def read(name)
end

class STDOUT < Base
def puts(data)
command("print_line", data: data)
def puts(data = nil)
command("print_line", data: data.to_s)
end

def print(data)
Expand Down
8 changes: 8 additions & 0 deletions spec/integration/resources/stdout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
it 'prints line with newline to stdout through client' do
expect { server_stdout.puts("Hello line") }.to output("Hello line\n").to_stdout
end

it 'prints a blank line when called with no arguments' do
expect { server_stdout.puts }.to output("\n").to_stdout
end

it 'prints a blank line when called with nil' do
expect { server_stdout.puts(nil) }.to output("\n").to_stdout
end
end

describe '#flush' do
Expand Down