ruport 1.7.1 → 1.8.0
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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +38 -0
- data/HACKING +1 -17
- data/{README.rdoc → README.md} +30 -38
- data/Rakefile +0 -10
- data/examples/row_renderer.rb +1 -1
- data/examples/simple_pdf_lines.rb +1 -1
- data/examples/trac_ticket_status.rb +1 -1
- data/lib/ruport/controller.rb +1 -1
- data/lib/ruport/data/grouping.rb +7 -7
- data/lib/ruport/data/record.rb +4 -4
- data/lib/ruport/data/table.rb +9 -9
- data/lib/ruport/formatter/csv.rb +1 -1
- data/lib/ruport/formatter/markdown.rb +105 -0
- data/lib/ruport/formatter/prawn_pdf.rb +96 -9
- data/lib/ruport/formatter/text.rb +1 -1
- data/lib/ruport/formatter.rb +1 -2
- data/lib/ruport/version.rb +1 -1
- data/lib/ruport.rb +7 -11
- data/test/controller_test.rb +107 -109
- data/test/csv_formatter_test.rb +21 -21
- data/test/data_feeder_test.rb +39 -39
- data/test/expected_outputs/prawn_pdf_formatter/pdf_basic.pdf.test +265 -0
- data/test/grouping_test.rb +74 -74
- data/test/helpers.rb +16 -5
- data/test/html_formatter_test.rb +22 -22
- data/test/markdown_formatter_test.rb +142 -0
- data/test/prawn_pdf_formatter_test.rb +108 -0
- data/test/record_test.rb +82 -82
- data/test/table_pivot_test.rb +9 -2
- data/test/table_test.rb +33 -40
- data/test/template_test.rb +12 -12
- data/test/text_formatter_test.rb +34 -34
- data/util/bench/data/table/bench_column_manip.rb +0 -1
- data/util/bench/data/table/bench_dup.rb +0 -1
- data/util/bench/data/table/bench_init.rb +0 -1
- data/util/bench/data/table/bench_manip.rb +0 -1
- data/util/bench/formatter/bench_csv.rb +0 -1
- data/util/bench/formatter/bench_html.rb +0 -1
- data/util/bench/formatter/bench_pdf.rb +0 -1
- data/util/bench/formatter/bench_text.rb +0 -1
- metadata +30 -29
- data/lib/ruport/formatter/pdf.rb +0 -589
data/test/table_test.rb
CHANGED
@@ -25,7 +25,7 @@ class TestTable < Minitest::Test
|
|
25
25
|
assert_equal n, t.column_names
|
26
26
|
|
27
27
|
t = Ruport.Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
28
|
-
|
28
|
+
Ruport.Table(t.column_names, :data => t.data)
|
29
29
|
end
|
30
30
|
|
31
31
|
a = Ruport::Data::Record.new [1,2,3]
|
@@ -41,14 +41,14 @@ class TestTable < Minitest::Test
|
|
41
41
|
@data = [[1,2,3],[4,5,6],[7,8,9]]
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
should "specify_filters_should_discard_unmatched_rows" do
|
45
45
|
table = Ruport::Data::Table.new(:column_names => %w[a b c],
|
46
46
|
:data => [[1,2,3],[4,5,6],[7,8,9]],
|
47
47
|
:filters => [ lambda { |r| r.a % 2 == 1 } ] )
|
48
48
|
assert_equal Ruport.Table(%w[a b c]) << [1,2,3] << [7,8,9], table
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
should "specify_filters_should_work_on_csvs" do
|
52
52
|
only_ids_less_than_3 = lambda { |r| r["id"].to_i < 3 }
|
53
53
|
table = Ruport.Table(File.join(TEST_SAMPLES,"addressbook.csv"),
|
54
54
|
:filters => [only_ids_less_than_3])
|
@@ -58,16 +58,16 @@ class TestTable < Minitest::Test
|
|
58
58
|
|
59
59
|
context "when transforming data" do
|
60
60
|
|
61
|
-
|
61
|
+
setup do
|
62
62
|
@data = [[1,2,3],[4,5,6],[7,8,9]]
|
63
63
|
end
|
64
64
|
|
65
|
-
|
65
|
+
should "specify_transforms_should_modify_table_data" do
|
66
66
|
|
67
67
|
stringify_c = lambda { |r| r.c = r.c.to_s }
|
68
68
|
add_two_to_all_int_cols = lambda { |r|
|
69
69
|
r.each_with_index do |c,i|
|
70
|
-
if
|
70
|
+
if Integer === c
|
71
71
|
r[i] += 2
|
72
72
|
end
|
73
73
|
end
|
@@ -83,7 +83,7 @@ class TestTable < Minitest::Test
|
|
83
83
|
|
84
84
|
end
|
85
85
|
|
86
|
-
|
86
|
+
should "specify_transforms_should_work_on_csvs" do
|
87
87
|
ids_to_i = lambda { |r| r["id"] = r["id"].to_i }
|
88
88
|
table = Ruport.Table(File.join(TEST_SAMPLES,"addressbook.csv"),
|
89
89
|
:filters => [ids_to_i])
|
@@ -186,12 +186,12 @@ class TestTable < Minitest::Test
|
|
186
186
|
|
187
187
|
context "when sorting rows" do
|
188
188
|
|
189
|
-
|
189
|
+
setup do
|
190
190
|
@table = Ruport.Table(%w[a b c]) << [1,2,3] << [6,1,8] << [9,1,4]
|
191
191
|
@table_with_nils = Ruport.Table(%w[a b c]) << [1,nil,3] << [9,3,4] << [6,1,8]
|
192
192
|
end
|
193
193
|
|
194
|
-
|
194
|
+
should "specify_should_sort_in_reverse_order_on_descending" do
|
195
195
|
t = @table.sort_rows_by("a", :order => :descending )
|
196
196
|
assert_equal Ruport.Table(%w[a b c]) << [9,1,4] << [6,1,8] << [1,2,3], t
|
197
197
|
|
@@ -199,7 +199,7 @@ class TestTable < Minitest::Test
|
|
199
199
|
assert_equal Ruport.Table(%w[a b c]) << [6,1,8] << [9,1,4] << [1,2,3], t
|
200
200
|
end
|
201
201
|
|
202
|
-
|
202
|
+
should "specify_show_put_rows_with_nil_columns_after_sorted_rows" do
|
203
203
|
# should not effect when using columns that are all populated
|
204
204
|
t = @table_with_nils.sort_rows_by("a")
|
205
205
|
assert_equal Ruport.Table(%w[a b c]) << [1,nil,3] << [6,1,8] << [9,3,4], t
|
@@ -211,12 +211,12 @@ class TestTable < Minitest::Test
|
|
211
211
|
assert_equal Ruport.Table(%w[a b c]) << [1,nil,3] << [9,3,4] << [6,1,8], t
|
212
212
|
end
|
213
213
|
|
214
|
-
|
214
|
+
should "specify_in_place_sort_should_allow_order_by" do
|
215
215
|
@table.sort_rows_by!("a", :order => :descending )
|
216
216
|
assert_equal Ruport.Table(%w[a b c]) << [9,1,4] << [6,1,8] << [1,2,3], @table
|
217
217
|
end
|
218
218
|
|
219
|
-
|
219
|
+
should "specify_sort_rows_by" do
|
220
220
|
table = Ruport::Data::Table.new :column_names => %w[a b c]
|
221
221
|
table << [1,2,3] << [6,1,8] << [9,1,4]
|
222
222
|
|
@@ -241,7 +241,7 @@ class TestTable < Minitest::Test
|
|
241
241
|
assert_equal sorted_table_bs, table2.sort_rows_by(:b)
|
242
242
|
end
|
243
243
|
|
244
|
-
|
244
|
+
should "specify_sort_rows_by!" do
|
245
245
|
table = Ruport::Data::Table.new :column_names => %w[a b c]
|
246
246
|
table << [1,2,3] << [6,1,8] << [9,1,4]
|
247
247
|
|
@@ -271,32 +271,32 @@ class TestTable < Minitest::Test
|
|
271
271
|
end
|
272
272
|
|
273
273
|
context "when adding rows" do
|
274
|
-
|
274
|
+
setup do
|
275
275
|
@columns = %w[a b c]
|
276
276
|
@data = [[1,2,3],[4,5,6],[7,8,9]]
|
277
277
|
@table = Ruport::Data::Table.new(:column_names => @columns, :data => @data)
|
278
278
|
@new_row = [-1,-2,-3]
|
279
279
|
end
|
280
280
|
|
281
|
-
|
281
|
+
should "specify_insert_at_the_beginning" do
|
282
282
|
@table.add_row(@new_row, :position => 0)
|
283
283
|
assert_equal Ruport::Data::Table.new(:column_names => @columns,
|
284
284
|
:data => [@new_row] + @data), @table
|
285
285
|
end
|
286
286
|
|
287
|
-
|
287
|
+
should "specify_insert_in_the_middle" do
|
288
288
|
@table.add_row(@new_row, :position => 2)
|
289
289
|
assert_equal Ruport::Data::Table.new(:column_names => @columns,
|
290
290
|
:data => [[1,2,3],[4,5,6],[-1,-2,-3],[7,8,9]]), @table
|
291
291
|
end
|
292
292
|
|
293
|
-
|
293
|
+
should "specify_insert_at_the_end" do
|
294
294
|
@table.add_row(@new_row)
|
295
295
|
assert_equal Ruport::Data::Table.new(:column_names => @columns,
|
296
296
|
:data => @data + [@new_row]), @table
|
297
297
|
end
|
298
298
|
|
299
|
-
|
299
|
+
should "return_itself" do
|
300
300
|
assert_equal @table.object_id, @table.add_row(@new_row).object_id
|
301
301
|
end
|
302
302
|
end
|
@@ -336,7 +336,7 @@ class TestTable < Minitest::Test
|
|
336
336
|
assert_equal %w[a b c], a.column_names
|
337
337
|
a.each { |r|
|
338
338
|
assert_equal %w[a b c], r.attributes
|
339
|
-
r.a; r.b; r.c
|
339
|
+
r.a; r.b; r.c
|
340
340
|
[r.a,r.b,r.c].each { |i| assert(i.kind_of?(Numeric)) }
|
341
341
|
}
|
342
342
|
assert_equal %w[d e f], b.column_names
|
@@ -367,7 +367,7 @@ class TestTable < Minitest::Test
|
|
367
367
|
t << %w[joe loop]
|
368
368
|
}
|
369
369
|
assert_equal "joe loop", a[0].name
|
370
|
-
a.to_yaml
|
370
|
+
a.to_yaml
|
371
371
|
end
|
372
372
|
|
373
373
|
def test_ensure_subtable_works_with_unnamed_tables
|
@@ -473,7 +473,7 @@ class TestTableFormattingHooks < Minitest::Test
|
|
473
473
|
def test_as_throws_proper_errors
|
474
474
|
a = Ruport.Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
475
475
|
a.as(:csv)
|
476
|
-
a.to_csv
|
476
|
+
a.to_csv
|
477
477
|
assert_raises(Ruport::Controller::UnknownFormatError) { a.as(:nothing) }
|
478
478
|
assert_raises(Ruport::Controller::UnknownFormatError) { a.to_nothing }
|
479
479
|
end
|
@@ -693,9 +693,9 @@ class TestTableColumnOperations < Minitest::Test
|
|
693
693
|
|
694
694
|
def test_ensure_renaming_a_missing_column_fails_silently
|
695
695
|
a = Ruport.Table(%w[a b c])
|
696
|
-
|
696
|
+
|
697
697
|
a.rename_column("d", "z")
|
698
|
-
|
698
|
+
|
699
699
|
end
|
700
700
|
|
701
701
|
end
|
@@ -719,7 +719,7 @@ class TestTableFromCSV < Minitest::Test
|
|
719
719
|
|
720
720
|
table = Ruport::Data::Table.load( File.join(TEST_SAMPLES,"data.csv"),
|
721
721
|
:csv_options => { :headers => true, :header_converters => :symbol }
|
722
|
-
) do |
|
722
|
+
) do |_s,r|
|
723
723
|
assert_equal expected.shift, r[:col3]
|
724
724
|
end
|
725
725
|
|
@@ -728,7 +728,7 @@ class TestTableFromCSV < Minitest::Test
|
|
728
728
|
expected = ['c','e']
|
729
729
|
|
730
730
|
Ruport::Data::Table.load( File.join(TEST_SAMPLES,"data.csv"),
|
731
|
-
:records => true ) do |
|
731
|
+
:records => true ) do |_s,r|
|
732
732
|
assert_equal expected.shift, r.col3
|
733
733
|
assert_kind_of Ruport::Data::Record, r
|
734
734
|
end
|
@@ -742,9 +742,9 @@ class TestTableFromCSV < Minitest::Test
|
|
742
742
|
|
743
743
|
# ticket:76
|
744
744
|
def test_parse
|
745
|
-
|
745
|
+
|
746
746
|
Ruport::Data::Table.parse("a,b,c\n1,2,3\n")
|
747
|
-
|
747
|
+
|
748
748
|
|
749
749
|
table = Ruport::Data::Table.parse("a,b,c\n1,2,3\n4,5,6\n")
|
750
750
|
expected = Ruport.Table(%w[a b c], :data => [%w[1 2 3],%w[4 5 6]])
|
@@ -791,27 +791,21 @@ class TestTableFromCSV < Minitest::Test
|
|
791
791
|
end
|
792
792
|
|
793
793
|
def test_ensure_csv_loading_accepts_table_options
|
794
|
-
|
795
|
-
|
796
|
-
a.each { |r| assert_kind_of(DuckRecord,r) }
|
794
|
+
a = Ruport.Table(File.join(TEST_SAMPLES,"addressbook.csv"), :record_class => DuckRecord)
|
795
|
+
a.each { |r| assert_kind_of(DuckRecord,r) }
|
797
796
|
end
|
798
797
|
|
799
798
|
def test_ensure_table_from_csv_accepts_record_class_in_block_usage
|
800
|
-
|
801
|
-
|
802
|
-
assert_kind_of(DuckRecord,r)
|
799
|
+
Ruport.Table(File.join(TEST_SAMPLES,"addressbook.csv"), :record_class => DuckRecord, :records => true) do |_s,r|
|
800
|
+
assert_kind_of(DuckRecord,r)
|
803
801
|
end
|
804
802
|
end
|
805
|
-
|
806
803
|
end
|
807
804
|
|
808
805
|
class TestTableKernelHack < Minitest::Test
|
809
|
-
|
810
806
|
def test_simple
|
811
|
-
assert_equal Ruport::Data::Table.new(:column_names => %w[a b c]),
|
812
|
-
|
813
|
-
assert_equal Ruport::Data::Table.new(:column_names => %w[a b c]),
|
814
|
-
Ruport.Table("a","b","c")
|
807
|
+
assert_equal Ruport::Data::Table.new(:column_names => %w[a b c]), Ruport.Table(%w[a b c])
|
808
|
+
assert_equal Ruport::Data::Table.new(:column_names => %w[a b c]), Ruport.Table("a","b","c")
|
815
809
|
assert_equal Ruport::Data::Table.load(
|
816
810
|
File.join(TEST_SAMPLES,"addressbook.csv")),
|
817
811
|
Ruport.Table(File.join(TEST_SAMPLES,"addressbook.csv"))
|
@@ -863,5 +857,4 @@ class TestTableKernelHack < Minitest::Test
|
|
863
857
|
assert_equal Ruport::Data::Table.new(:column_names => %w[a b c]),
|
864
858
|
Ruport.Table(:column_names => %w[a b c])
|
865
859
|
end
|
866
|
-
|
867
860
|
end
|
data/test/template_test.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
#!/usr/bin/env ruby -w
|
2
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "helpers")
|
2
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "helpers")
|
3
3
|
|
4
4
|
class TemplateTest < Minitest::Test
|
5
|
-
|
5
|
+
|
6
6
|
def setup
|
7
7
|
@template_class = Ruport::Formatter::Template.dup
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def teardown
|
11
11
|
Ruport::Formatter::Template.instance_variable_set(:@templates, nil)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def test_template_should_exist
|
15
15
|
@template_class.create(:foo)
|
16
|
-
assert_instance_of @template_class,
|
16
|
+
assert_instance_of @template_class,
|
17
17
|
@template_class[:foo]
|
18
|
-
end
|
19
|
-
|
18
|
+
end
|
19
|
+
|
20
20
|
def test_template_creation_yields_an_options_object
|
21
21
|
@template_class.create(:foo) do |template|
|
22
22
|
template.page_format = { :layout => :landscape,
|
23
23
|
:paper_size => :letter }
|
24
24
|
end
|
25
25
|
assert_equal :landscape, @template_class[:foo].page_format[:layout]
|
26
|
-
assert_equal :letter, @template_class[:foo].page_format[:paper_size]
|
26
|
+
assert_equal :letter, @template_class[:foo].page_format[:paper_size]
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def test_create_derived_template
|
30
30
|
Ruport::Formatter::Template.create(:foo) do |template|
|
31
31
|
template.page_format = { :layout => :landscape,
|
@@ -35,14 +35,14 @@ class TemplateTest < Minitest::Test
|
|
35
35
|
assert_equal :landscape,
|
36
36
|
Ruport::Formatter::Template[:bar].page_format[:layout]
|
37
37
|
assert_equal :letter,
|
38
|
-
Ruport::Formatter::Template[:bar].page_format[:paper_size]
|
38
|
+
Ruport::Formatter::Template[:bar].page_format[:paper_size]
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
def test_default_template
|
42
42
|
assert_nil Ruport::Formatter::Template.default
|
43
43
|
Ruport::Formatter::Template.create(:default)
|
44
44
|
assert_equal Ruport::Formatter::Template[:default],
|
45
45
|
Ruport::Formatter::Template.default
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
end
|
data/test/text_formatter_test.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), "helpers")
|
3
3
|
|
4
4
|
class TestRenderTextTable < Minitest::Test
|
5
|
-
|
5
|
+
|
6
6
|
def setup
|
7
7
|
Ruport::Formatter::Template.create(:simple) do |format|
|
8
8
|
format.table = {
|
@@ -22,50 +22,50 @@ class TestRenderTextTable < Minitest::Test
|
|
22
22
|
|
23
23
|
def test_basic
|
24
24
|
tf = "+-------+\n"
|
25
|
-
|
25
|
+
|
26
26
|
a = Ruport.Table([], :data => [[1,2],[3,4]]).to_text
|
27
27
|
assert_equal("#{tf}| 1 | 2 |\n| 3 | 4 |\n#{tf}",a)
|
28
28
|
|
29
29
|
a = Ruport.Table(%w[a b], :data => [[1,2],[3,4]]).to_text
|
30
30
|
assert_equal("#{tf}| a | b |\n#{tf}| 1 | 2 |\n| 3 | 4 |\n#{tf}", a)
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def test_centering
|
34
|
-
tf = "+---------+\n"
|
34
|
+
tf = "+---------+\n"
|
35
35
|
|
36
36
|
a = Ruport.Table([], :data => [[1,2],[300,4]])
|
37
37
|
assert_equal( "#{tf}| 1 | 2 |\n| 300 | 4 |\n#{tf}",
|
38
38
|
a.to_text(:alignment => :center) )
|
39
39
|
|
40
40
|
tf = "+------------+\n"
|
41
|
-
a.column_names = %w[a bark]
|
41
|
+
a.column_names = %w[a bark]
|
42
42
|
assert_equal("#{tf}| a | bark |\n#{tf}| 1 | 2 |\n"+
|
43
|
-
"| 300 | 4 |\n#{tf}", a.to_text(:alignment => :center) )
|
43
|
+
"| 300 | 4 |\n#{tf}", a.to_text(:alignment => :center) )
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_justified
|
47
47
|
tf = "+----------+\n"
|
48
48
|
a = Ruport.Table([], :data => [[1,'Z'],[300,'BB']])
|
49
|
-
|
49
|
+
|
50
50
|
# justified alignment can be set explicitly
|
51
|
-
assert_equal "#{tf}| 1 | Z |\n| 300 | BB |\n#{tf}",
|
52
|
-
a.to_text(:alignment => :justified)
|
53
|
-
|
54
|
-
# justified alignment is also default
|
55
|
-
assert_equal "#{tf}| 1 | Z |\n| 300 | BB |\n#{tf}", a.to_s
|
51
|
+
assert_equal "#{tf}| 1 | Z |\n| 300 | BB |\n#{tf}",
|
52
|
+
a.to_text(:alignment => :justified)
|
53
|
+
|
54
|
+
# justified alignment is also default
|
55
|
+
assert_equal "#{tf}| 1 | Z |\n| 300 | BB |\n#{tf}", a.to_s
|
56
56
|
end
|
57
57
|
|
58
|
-
def test_wrapping
|
58
|
+
def test_wrapping
|
59
59
|
a = Ruport.Table([], :data => [[1,2],[300,4]]).to_text(:table_width => 10)
|
60
60
|
assert_equal("+------->>\n| 1 | >>\n| 300 | >>\n+------->>\n",a)
|
61
|
-
end
|
62
|
-
|
61
|
+
end
|
62
|
+
|
63
63
|
def test_ignore_wrapping
|
64
|
-
a = Ruport.Table([], :data => [[1,2],[300,4]]).to_text(:table_width => 10,
|
64
|
+
a = Ruport.Table([], :data => [[1,2],[300,4]]).to_text(:table_width => 10,
|
65
65
|
:ignore_table_width => true )
|
66
66
|
assert_equal("+---------+\n| 1 | 2 |\n| 300 | 4 |\n+---------+\n",a)
|
67
|
-
end
|
68
|
-
|
67
|
+
end
|
68
|
+
|
69
69
|
def test_render_empty_table
|
70
70
|
assert_raises(Ruport::FormatterError) { Ruport.Table([]).to_text }
|
71
71
|
Ruport.Table(%w[a b c]).to_text
|
@@ -76,13 +76,13 @@ class TestRenderTextTable < Minitest::Test
|
|
76
76
|
"+-----------+\n"
|
77
77
|
assert_equal expected, a
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
def test_render_with_template
|
81
81
|
formatter = Ruport::Formatter::Text.new
|
82
82
|
formatter.options = Ruport::Controller::Options.new
|
83
83
|
formatter.options.template = :simple
|
84
84
|
formatter.apply_template
|
85
|
-
|
85
|
+
|
86
86
|
assert_equal false, formatter.options.show_table_headers
|
87
87
|
assert_equal 50, formatter.options.table_width
|
88
88
|
assert_equal true, formatter.options.ignore_table_width
|
@@ -92,7 +92,7 @@ class TestRenderTextTable < Minitest::Test
|
|
92
92
|
|
93
93
|
assert_equal false, formatter.options.show_group_headers
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
def test_options_hashes_override_template
|
97
97
|
opts = nil
|
98
98
|
table = Ruport.Table(%w[a b c])
|
@@ -113,7 +113,7 @@ class TestRenderTextTable < Minitest::Test
|
|
113
113
|
) do |r|
|
114
114
|
opts = r.options
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
assert_equal true, opts.show_table_headers
|
118
118
|
assert_equal 25, opts.table_width
|
119
119
|
assert_equal false, opts.ignore_table_width
|
@@ -138,7 +138,7 @@ class TestRenderTextTable < Minitest::Test
|
|
138
138
|
) do |r|
|
139
139
|
opts = r.options
|
140
140
|
end
|
141
|
-
|
141
|
+
|
142
142
|
assert_equal true, opts.show_table_headers
|
143
143
|
assert_equal 75, opts.table_width
|
144
144
|
assert_equal false, opts.ignore_table_width
|
@@ -148,7 +148,7 @@ class TestRenderTextTable < Minitest::Test
|
|
148
148
|
|
149
149
|
assert_equal true, opts.show_group_headers
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
# -- BUG TRAPS ------------------------------
|
153
153
|
|
154
154
|
def test_should_render_without_column_names
|
@@ -158,9 +158,9 @@ class TestRenderTextTable < Minitest::Test
|
|
158
158
|
"+-----------+\n"
|
159
159
|
assert_equal(expected,a)
|
160
160
|
end
|
161
|
-
|
161
|
+
|
162
162
|
end
|
163
|
-
|
163
|
+
|
164
164
|
|
165
165
|
class TestRenderTextRow < Minitest::Test
|
166
166
|
|
@@ -170,7 +170,7 @@ class TestRenderTextRow < Minitest::Test
|
|
170
170
|
end
|
171
171
|
|
172
172
|
end
|
173
|
-
|
173
|
+
|
174
174
|
|
175
175
|
class TestRenderTextGroup < Minitest::Test
|
176
176
|
|
@@ -196,7 +196,7 @@ class TestRenderTextGroup < Minitest::Test
|
|
196
196
|
:data => [ %w[is this more],
|
197
197
|
%w[interesting red snapper]],
|
198
198
|
:column_names => %w[i hope so])
|
199
|
-
|
199
|
+
|
200
200
|
actual = Ruport::Controller::Group.render(:text, :data => group,
|
201
201
|
:show_table_headers => false )
|
202
202
|
expected = "test:\n\n"+
|
@@ -205,9 +205,9 @@ class TestRenderTextGroup < Minitest::Test
|
|
205
205
|
"| interesting | red | snapper |\n"+
|
206
206
|
"+------------------------------+\n"
|
207
207
|
assert_equal(expected, actual)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
211
|
|
212
212
|
class TestRenderTextGrouping < Minitest::Test
|
213
213
|
|
@@ -230,8 +230,8 @@ class TestRenderTextGrouping < Minitest::Test
|
|
230
230
|
"+-------------+\n"+
|
231
231
|
"| this | more |\n"+
|
232
232
|
"+-------------+\n\n"
|
233
|
-
assert_equal(expected, actual)
|
234
|
-
|
233
|
+
assert_equal(expected, actual)
|
234
|
+
|
235
235
|
actual = grouping.to_s
|
236
236
|
assert_equal(expected,actual)
|
237
237
|
end
|
@@ -254,5 +254,5 @@ class TestRenderTextGrouping < Minitest::Test
|
|
254
254
|
"+-------------+\n\n"
|
255
255
|
assert_equal(expected, actual)
|
256
256
|
end
|
257
|
-
|
257
|
+
|
258
258
|
end
|