File: table_tests.rb

package info (click to toggle)
ruby-formatador 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 96 kB
  • sloc: ruby: 299; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 816 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Shindo.tests("Formatador") do

output = <<-OUTPUT
    +---+
    | \e[1ma\e[0m |
    +---+
    | 1 |
    +---+
    | 2 |
    +---+
OUTPUT

  tests("#display_table([{:a => 1}, {:a => 2}])").returns(output) do
    capture_stdout do
      Formatador.display_table([{:a => 1}, {:a => 2}])
    end
  end

output = <<-OUTPUT
    +--------+
    | \e[1mheader\e[0m |
    +--------+
    +--------+
OUTPUT

  tests("#display_table([], [:header])").returns(output) do
    capture_stdout do
      Formatador.display_table([], [:header])
    end
  end

output = <<-OUTPUT
    +--------+
    | \e[1mheader\e[0m |
    +--------+
    |        |
    +--------+
OUTPUT

  tests("#display_table([{:a => 1}], [:header])").returns(output) do
    capture_stdout do
      Formatador.display_table([{:a => 1}], [:header])
    end
  end

end