Module: MediaWikiVagrant::OutputHelper

Defined in:
tests/features/support/output_helper.rb

Overview

Helper methods for simulating command I/O.

See Also:

Instance Method Summary collapse

Instance Method Details

#enter(line) ⇒ Object



17
18
19
# File 'tests/features/support/output_helper.rb', line 17

def enter(line)
  @stdin_w.puts line
end

#output_column(column) ⇒ Object



21
22
23
24
# File 'tests/features/support/output_helper.rb', line 21

def output_column(column)
  column = [:first, :second, :third, :forth].index(column.to_sym) if column.is_a?(String)
  stdout.lines.map { |line| line.split[column] }
end

#output_table(width) ⇒ Object



26
27
28
# File 'tests/features/support/output_helper.rb', line 26

def output_table(width)
  stdout.lines.map { |line| line.split(/[ \t]+/, width).map(&:strip) }
end

#stderr(bytes = 4096) ⇒ Object



13
14
15
# File 'tests/features/support/output_helper.rb', line 13

def stderr(bytes = 4096)
  Timeout.timeout(3) { normalize_output(@stderr_r.readpartial(bytes)) }
end

#stdout(bytes = 4096) ⇒ Object



9
10
11
# File 'tests/features/support/output_helper.rb', line 9

def stdout(bytes = 4096)
  Timeout.timeout(3) { normalize_output(@stdout_r.readpartial(bytes)) }
end