Skip to content

Commit

Permalink
cleanup test output formatting
Browse files Browse the repository at this point in the history
also allows tests to pass with non-tty STDOUT
closes #6
  • Loading branch information
geemus committed Oct 19, 2011
1 parent 84ce206 commit a874311
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/basic_tests.rb
Expand Up @@ -10,6 +10,7 @@
one
two
OUTPUT
output = Formatador.parse(output)

tests("#display_lines(['one', 'two']").returns(output) do
capture_stdout do
Expand Down
9 changes: 6 additions & 3 deletions tests/table_tests.rb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a874311

Please sign in to comment.