tty 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,75 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require 'spec_helper'
4
-
5
- describe TTY::Table do
6
-
7
- it { should be_kind_of(Enumerable) }
8
- it { should be_kind_of(Comparable) }
9
-
10
- it { (Enumerable === subject).should be_true }
11
-
12
- context '#initalize' do
13
- let(:header) { ['Header1', 'Header2'] }
14
- let(:rows) { [['a1', 'a2'], ['b1', 'b2']] }
15
-
16
- it 'initializes table header' do
17
- table = TTY::Table.new header
18
- table.header.should == header
19
- end
20
-
21
- it 'initializes table header as an option' do
22
- table = TTY::Table.new :header => header
23
- table.header.should == header
24
- end
25
-
26
- it 'initializes table rows as an option' do
27
- table = TTY::Table.new :header => header, :rows => rows
28
- table.to_a.should == rows
29
- end
30
-
31
- it 'initializes table rows as an argument' do
32
- table = TTY::Table.new header, rows
33
- table.to_a.should == rows
34
- end
35
-
36
- it 'initializes table rows in a block with param' do
37
- table = TTY::Table.new header do |t|
38
- t << rows[0]
39
- t << rows[1]
40
- end
41
- table.to_a.should == rows
42
- end
43
-
44
- it 'initializes table and adds rows' do
45
- table = TTY::Table.new header
46
- table << rows[0]
47
- table << rows[1]
48
- table.to_a.should == rows
49
- end
50
- end
51
-
52
- context '#size' do
53
- it 'has no size' do
54
- table = TTY::Table.new
55
- table.size.should == 0
56
- end
57
-
58
- it 'has size' do
59
- rows = [['a1', 'a2', 'a3'], ['b1', 'b2', 'c3']]
60
- table = TTY::Table.new ['Header1', 'Header2'], rows
61
- table.size.should == 3
62
- end
63
- end
64
-
65
- context '#columns' do
66
- it 'looks up column' do
67
- rows = [['a1', 'a2'], ['b1', 'b2']]
68
- table = TTY::Table.new
69
- table << rows[0]
70
- table << rows[1]
71
- table[0].should == ['a1', 'b1']
72
- end
73
- end
74
-
75
- end # TTY::Table