From a874311f52a34b9a1f1d0fe9fef20a095b79f941 Mon Sep 17 00:00:00 2001 From: geemus Date: Wed, 19 Oct 2011 10:17:37 -0500 Subject: [PATCH] cleanup test output formatting also allows tests to pass with non-tty STDOUT closes #6 --- tests/basic_tests.rb | 1 + tests/table_tests.rb | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/basic_tests.rb b/tests/basic_tests.rb index 4021093..9e46caf 100644 --- a/tests/basic_tests.rb +++ b/tests/basic_tests.rb @@ -10,6 +10,7 @@ one two OUTPUT +output = Formatador.parse(output) tests("#display_lines(['one', 'two']").returns(output) do capture_stdout do diff --git a/tests/table_tests.rb b/tests/table_tests.rb index f6ffd17..91cde51 100644 --- a/tests/table_tests.rb +++ b/tests/table_tests.rb @@ -2,13 +2,14 @@ output = <<-OUTPUT +---+ - | \e[1ma\e[0m | + | [bold]a[/] | +---+ | 1 | +---+ | 2 | +---+ OUTPUT +output = Formatador.parse(output) tests("#display_table([{:a => 1}, {:a => 2}])").returns(output) do capture_stdout do @@ -18,10 +19,11 @@ output = <<-OUTPUT +--------+ - | \e[1mheader\e[0m | + | [bold]header[/] | +--------+ +--------+ OUTPUT +output = Formatador.parse(output) tests("#display_table([], [:header])").returns(output) do capture_stdout do @@ -31,11 +33,12 @@ output = <<-OUTPUT +--------+ - | \e[1mheader\e[0m | + | [bold]header[/] | +--------+ | | +--------+ OUTPUT +output = Formatador.parse(output) tests("#display_table([{:a => 1}], [:header])").returns(output) do capture_stdout do