ruport 1.6.3 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +11 -0
- data/CHANGELOG.md +38 -0
- data/HACKING +1 -17
- data/README.md +97 -0
- data/Rakefile +9 -50
- data/examples/add_row_table.rb +46 -0
- data/examples/data/wine.csv +255 -0
- data/examples/pdf_grouping.rb +39 -0
- data/examples/pdf_table.rb +28 -0
- data/examples/pdf_table_from_csv.rb +26 -0
- data/examples/pdf_table_prawn.rb +30 -0
- data/examples/pdf_table_simple.rb +13 -0
- 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 +17 -21
- data/lib/ruport/data/feeder.rb +2 -2
- data/lib/ruport/data/grouping.rb +8 -8
- data/lib/ruport/data/record.rb +4 -4
- data/lib/ruport/data/table.rb +318 -206
- data/lib/ruport/formatter/csv.rb +6 -7
- data/lib/ruport/formatter/html.rb +13 -11
- data/lib/ruport/formatter/markdown.rb +105 -0
- data/lib/ruport/formatter/prawn_pdf.rb +159 -0
- data/lib/ruport/formatter/template.rb +1 -1
- data/lib/ruport/formatter/text.rb +1 -1
- data/lib/ruport/formatter.rb +54 -54
- data/lib/ruport/version.rb +1 -1
- data/lib/ruport.rb +7 -23
- data/test/controller_test.rb +201 -225
- data/test/csv_formatter_test.rb +36 -36
- data/test/data_feeder_test.rb +64 -64
- data/test/expected_outputs/prawn_pdf_formatter/pdf_basic.pdf.test +265 -0
- data/test/grouping_test.rb +103 -102
- data/test/helpers.rb +29 -10
- data/test/html_formatter_test.rb +46 -46
- data/test/markdown_formatter_test.rb +142 -0
- data/test/prawn_pdf_formatter_test.rb +108 -0
- data/test/record_test.rb +91 -91
- data/test/samples/sales.csv +21 -0
- data/test/table_pivot_test.rb +77 -26
- data/test/table_test.rb +376 -354
- data/test/template_test.rb +13 -13
- data/test/text_formatter_test.rb +52 -52
- 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 +1 -2
- 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 +131 -82
- data/README +0 -114
- data/lib/ruport/formatter/pdf.rb +0 -591
- data/test/pdf_formatter_test.rb +0 -354
data/test/grouping_test.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby -w
|
1
|
+
#!/usr/bin/env ruby -w
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), "helpers")
|
3
3
|
|
4
|
-
class TestGroup < Test
|
4
|
+
class TestGroup < Minitest::Test
|
5
5
|
|
6
6
|
def setup
|
7
7
|
@group = Ruport::Data::Group.new(:name => 'test',
|
8
8
|
:data => [[1,2,3]],
|
9
9
|
:column_names => %w[a b c])
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def test_group_constructor
|
13
13
|
group = Ruport::Data::Group.new(:name => 'test',
|
14
14
|
:data => [[1,2,3]],
|
@@ -34,7 +34,7 @@ class TestGroup < Test::Unit::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_eql
|
37
|
-
table = Table(%w[a b c], :data => [[1,2,3]])
|
37
|
+
table = Ruport.Table(%w[a b c], :data => [[1,2,3]])
|
38
38
|
|
39
39
|
group2 = Ruport::Data::Group.new(:name => 'test',
|
40
40
|
:data => [[1,2,3]],
|
@@ -44,7 +44,7 @@ class TestGroup < Test::Unit::TestCase
|
|
44
44
|
assert_equal @group, group2
|
45
45
|
assert_equal @group, @group.dup
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def test_create_subgroups
|
49
49
|
group = @group << [4,5,6]
|
50
50
|
group.send(:create_subgroups, "a")
|
@@ -55,7 +55,7 @@ class TestGroup < Test::Unit::TestCase
|
|
55
55
|
:column_names => %w[b c],
|
56
56
|
:name => 4 ) }
|
57
57
|
assert_equal b, group.subgroups
|
58
|
-
|
58
|
+
|
59
59
|
group.send(:create_subgroups, "b")
|
60
60
|
c = { 2 => Ruport::Data::Group.new( :data => [[3]],
|
61
61
|
:column_names => %w[c],
|
@@ -65,8 +65,8 @@ class TestGroup < Test::Unit::TestCase
|
|
65
65
|
:name => 5 ) }
|
66
66
|
assert_equal c, group.subgroups[1].subgroups
|
67
67
|
assert_equal d, group.subgroups[4].subgroups
|
68
|
-
end
|
69
|
-
|
68
|
+
end
|
69
|
+
|
70
70
|
def test_grouped_data
|
71
71
|
a = @group << [4,5,6]
|
72
72
|
b = { 1 => Ruport::Data::Group.new( :data => [[2,3]],
|
@@ -79,24 +79,25 @@ class TestGroup < Test::Unit::TestCase
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
class TestGroupRendering < Test
|
82
|
+
class TestGroupRendering < Minitest::Test
|
83
83
|
|
84
84
|
def setup
|
85
85
|
@group = Ruport::Data::Group.new(:name => 'test',
|
86
86
|
:data => [[1,2,3]],
|
87
87
|
:column_names => %w[a b c])
|
88
|
-
end
|
88
|
+
end
|
89
89
|
|
90
90
|
def test_group_as
|
91
|
-
assert_equal(7, @group.to_text.
|
91
|
+
assert_equal(7, @group.to_text.split("\n").size)
|
92
92
|
assert_equal(5, @group.as(:text,
|
93
|
-
:show_table_headers => false).
|
94
|
-
assert_equal(
|
93
|
+
:show_table_headers => false).split("\n").size)
|
94
|
+
assert_equal(15, @group.to_html.split("\n").size)
|
95
|
+
assert_equal(8, @group.to_html(:show_table_headers => false).split("\n").size)
|
95
96
|
end
|
96
|
-
|
97
|
+
|
97
98
|
def test_as_throws_proper_errors
|
98
|
-
|
99
|
-
|
99
|
+
@group.as(:csv)
|
100
|
+
@group.to_csv
|
100
101
|
assert_raises(Ruport::Controller::UnknownFormatError) {
|
101
102
|
@group.as(:nothing) }
|
102
103
|
assert_raises(Ruport::Controller::UnknownFormatError) {
|
@@ -110,16 +111,16 @@ class TestGroupRendering < Test::Unit::TestCase
|
|
110
111
|
assert_equal "1\n\nb,c\n2,3\n", t.to_csv
|
111
112
|
end
|
112
113
|
end
|
113
|
-
|
114
|
-
class TestGrouping < Test
|
115
|
-
|
114
|
+
|
115
|
+
class TestGrouping < Minitest::Test
|
116
|
+
|
116
117
|
def setup
|
117
|
-
table = Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
118
|
+
table = Ruport.Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
118
119
|
@grouping = Ruport::Data::Grouping.new(table, :by => "a")
|
119
120
|
end
|
120
|
-
|
121
|
+
|
121
122
|
def test_grouping_constructor
|
122
|
-
a = Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
123
|
+
a = Ruport.Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
123
124
|
b = Ruport::Data::Grouping.new(a, :by => "a")
|
124
125
|
c = { 1 => Ruport::Data::Group.new( :data => [[2,3]],
|
125
126
|
:column_names => %w[b c],
|
@@ -128,24 +129,24 @@ class TestGrouping < Test::Unit::TestCase
|
|
128
129
|
:column_names => %w[b c],
|
129
130
|
:name => 4 ) }
|
130
131
|
assert_equal c, b.data
|
131
|
-
end
|
132
|
-
|
132
|
+
end
|
133
|
+
|
133
134
|
def test_empty_grouping
|
134
135
|
a = Ruport::Data::Grouping.new()
|
135
136
|
a << Group("foo",:data => [[1,2,3],[4,5,6]],
|
136
137
|
:column_names => %w[a b c] )
|
137
|
-
assert_equal "foo", a["foo"].name
|
138
|
-
assert_nil a.grouped_by
|
139
|
-
end
|
140
|
-
|
138
|
+
assert_equal "foo", a["foo"].name
|
139
|
+
assert_nil a.grouped_by
|
140
|
+
end
|
141
|
+
|
141
142
|
def test_empty_grouping_with_grouped_by
|
142
|
-
a = Ruport::Data::Grouping.new(:by => "nada")
|
143
|
+
a = Ruport::Data::Grouping.new(:by => "nada")
|
143
144
|
a << Group("foo",:data => [[1,2,3],[4,5,6]],
|
144
145
|
:column_names => %w[a b c] )
|
145
|
-
assert_equal "foo", a["foo"].name
|
146
|
+
assert_equal "foo", a["foo"].name
|
146
147
|
assert_equal "nada", a.grouped_by
|
147
148
|
end
|
148
|
-
|
149
|
+
|
149
150
|
def test_grouping_indexing
|
150
151
|
a = [Ruport::Data::Group.new( :data => [[2,3]],
|
151
152
|
:column_names => %w[b c],
|
@@ -159,8 +160,8 @@ class TestGrouping < Test::Unit::TestCase
|
|
159
160
|
assert_equal a[0], @grouping[1]
|
160
161
|
assert_equal a[1], @grouping[4]
|
161
162
|
assert_raises(IndexError) { @grouping[2] }
|
162
|
-
end
|
163
|
-
|
163
|
+
end
|
164
|
+
|
164
165
|
def test_should_copy_grouping
|
165
166
|
a = { 1 => Ruport::Data::Group.new( :data => [[2,3]],
|
166
167
|
:column_names => %w[b c],
|
@@ -174,19 +175,19 @@ class TestGrouping < Test::Unit::TestCase
|
|
174
175
|
end
|
175
176
|
|
176
177
|
def test_append
|
177
|
-
a = Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
178
|
+
a = Ruport.Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
178
179
|
@grouping << a.to_group("red snapper")
|
179
180
|
assert_equal @grouping["red snapper"], a.to_group("red snapper")
|
180
|
-
|
181
|
+
|
181
182
|
assert_raises(ArgumentError) { @grouping << a.to_group("red snapper") }
|
182
183
|
end
|
183
|
-
|
184
|
+
|
184
185
|
def test_grouped_by
|
185
186
|
assert_equal "a", @grouping.grouped_by
|
186
187
|
end
|
187
188
|
|
188
189
|
def test_grouping_on_multiple_columns
|
189
|
-
a = Table(%w[a b c d], :data => [[1,2,3,4],[4,5,6,7]])
|
190
|
+
a = Ruport.Table(%w[a b c d], :data => [[1,2,3,4],[4,5,6,7]])
|
190
191
|
b = Ruport::Data::Grouping.new(a, :by => %w[a b c])
|
191
192
|
c = { 1 => Ruport::Data::Group.new( :data => [[2,3,4]],
|
192
193
|
:column_names => %w[b c d],
|
@@ -204,10 +205,10 @@ class TestGrouping < Test::Unit::TestCase
|
|
204
205
|
:name => 5 ) }
|
205
206
|
assert_equal d, b[1].subgroups
|
206
207
|
assert_equal e, b[4].subgroups
|
207
|
-
end
|
208
|
+
end
|
208
209
|
|
209
210
|
def test_subgrouping
|
210
|
-
a = Table(%w[first_name last_name id])
|
211
|
+
a = Ruport.Table(%w[first_name last_name id])
|
211
212
|
a << %w[ greg brown awesome ]
|
212
213
|
a << %w[ mike milner schweet ]
|
213
214
|
a << %w[ greg brown sick ]
|
@@ -219,7 +220,7 @@ class TestGrouping < Test::Unit::TestCase
|
|
219
220
|
sub = (g / "mike")["milner"]
|
220
221
|
assert_equal %w[schweet], sub.column("id")
|
221
222
|
end
|
222
|
-
|
223
|
+
|
223
224
|
class TicketStatus < Ruport::Data::Record
|
224
225
|
|
225
226
|
def closed
|
@@ -231,41 +232,41 @@ class TestGrouping < Test::Unit::TestCase
|
|
231
232
|
end
|
232
233
|
|
233
234
|
end
|
234
|
-
|
235
|
+
|
235
236
|
def test_grouping_summary
|
236
|
-
source = Table(File.join(File.expand_path(File.dirname(__FILE__)),
|
237
|
+
source = Ruport.Table(File.join(File.expand_path(File.dirname(__FILE__)),
|
237
238
|
*%w[samples ticket_count.csv]),
|
238
239
|
:record_class => TicketStatus)
|
239
240
|
grouping = Grouping(source,:by => "date")
|
240
|
-
|
241
|
-
expected = Table(:date, :opened,:closed)
|
241
|
+
|
242
|
+
expected = Ruport.Table(:date, :opened,:closed)
|
242
243
|
grouping.each do |date,group|
|
243
244
|
opened = group.sigma { |r| r.opened }
|
244
245
|
closed = group.sigma { |r| r.closed }
|
245
246
|
expected << { :date => date, :opened => opened, :closed => closed }
|
246
247
|
end
|
247
|
-
|
248
|
+
|
248
249
|
actual = grouping.summary :date,
|
249
250
|
:opened => lambda { |g| g.sigma(:opened) },
|
250
251
|
:closed => lambda { |g| g.sigma(:closed) },
|
251
252
|
:order => [:date,:opened,:closed]
|
252
|
-
|
253
|
+
|
253
254
|
assert_equal expected, actual
|
254
|
-
|
255
|
+
|
255
256
|
actual = grouping.summary :date,
|
256
257
|
:opened => lambda { |g| g.sigma(:opened) },
|
257
258
|
:closed => lambda { |g| g.sigma(:closed) }
|
258
|
-
|
259
|
-
assert_equal [], expected.column_names - actual.column_names
|
260
|
-
end
|
261
|
-
|
259
|
+
|
260
|
+
assert_equal [], expected.column_names - actual.column_names
|
261
|
+
end
|
262
|
+
|
262
263
|
def test_grouping_sigma
|
263
264
|
assert_respond_to @grouping, :sigma
|
264
265
|
assert_respond_to @grouping, :sum
|
265
|
-
|
266
|
+
|
266
267
|
expected = {}
|
267
268
|
@grouping.data[@grouping.data.keys.first].column_names.each do |col|
|
268
|
-
expected[col] = @grouping.inject(0) do |s, (
|
269
|
+
expected[col] = @grouping.inject(0) do |s, (_group_name, group)|
|
269
270
|
s + group.sigma(col)
|
270
271
|
end
|
271
272
|
end
|
@@ -275,7 +276,7 @@ class TestGrouping < Test::Unit::TestCase
|
|
275
276
|
|
276
277
|
expected = {}
|
277
278
|
@grouping.data[@grouping.data.keys.first].column_names.each do |col|
|
278
|
-
expected[col] = @grouping.inject(0) do |s, (
|
279
|
+
expected[col] = @grouping.inject(0) do |s, (_group_name, group)|
|
279
280
|
s + group.sigma {|r| r[col] + 2 }
|
280
281
|
end
|
281
282
|
end
|
@@ -284,101 +285,101 @@ class TestGrouping < Test::Unit::TestCase
|
|
284
285
|
end
|
285
286
|
end
|
286
287
|
|
287
|
-
|
288
|
-
|
288
|
+
describe "when sorting groupings" do
|
289
|
+
|
289
290
|
def setup
|
290
|
-
@table = Table(%w[a b c]) << ["dog",1,2] << ["cat",3,5] <<
|
291
|
+
@table = Ruport.Table(%w[a b c]) << ["dog",1,2] << ["cat",3,5] <<
|
291
292
|
["banana",8,1] << ["dog",5,6] << ["dog",2,4] << ["banana",7,9]
|
292
293
|
end
|
293
|
-
|
294
|
-
def
|
295
|
-
a = Grouping(@table, :by => "a", :order => :name)
|
296
|
-
names = %w[banana cat dog]
|
294
|
+
|
295
|
+
def test_specify_can_set_by_group_name_order_in_constructor
|
296
|
+
a = Grouping(@table, :by => "a", :order => :name)
|
297
|
+
names = %w[banana cat dog]
|
297
298
|
data = [ [[8,1],[7,9]], [[3,5]], [[1,2],[5,6],[2,4]] ]
|
298
299
|
a.each do |name,group|
|
299
300
|
assert_equal names.shift, name
|
300
|
-
assert_equal data.shift, group.map { |r| r.to_a }
|
301
|
+
assert_equal data.shift, group.map { |r| r.to_a }
|
301
302
|
end
|
302
303
|
end
|
303
|
-
|
304
|
-
def
|
305
|
-
a = Grouping(@table, :by => "a", :order => lambda { |g| -g.length } )
|
306
|
-
names = %w[dog banana cat]
|
304
|
+
|
305
|
+
def test_specify_can_set_by_proc_ordering_in_constructor
|
306
|
+
a = Grouping(@table, :by => "a", :order => lambda { |g| -g.length } )
|
307
|
+
names = %w[dog banana cat]
|
307
308
|
data = [ [[1,2],[5,6],[2,4]], [[8,1],[7,9]], [[3,5]] ]
|
308
309
|
a.each do |name,group|
|
309
310
|
assert_equal names.shift, name
|
310
|
-
assert_equal data.shift, group.map { |r| r.to_a }
|
311
|
+
assert_equal data.shift, group.map { |r| r.to_a }
|
311
312
|
end
|
312
|
-
end
|
313
|
-
|
314
|
-
def
|
315
|
-
a = Grouping(@table, :by => "a", :order => lambda { |g| -g.length } )
|
313
|
+
end
|
314
|
+
|
315
|
+
def test_specify_can_override_sorting
|
316
|
+
a = Grouping(@table, :by => "a", :order => lambda { |g| -g.length } )
|
316
317
|
a.sort_grouping_by!(:name)
|
317
|
-
names = %w[banana cat dog]
|
318
|
+
names = %w[banana cat dog]
|
318
319
|
data = [ [[8,1],[7,9]], [[3,5]], [[1,2],[5,6],[2,4]] ]
|
319
320
|
a.each do |name,group|
|
320
321
|
assert_equal names.shift, name
|
321
|
-
assert_equal data.shift, group.map { |r| r.to_a }
|
322
|
+
assert_equal data.shift, group.map { |r| r.to_a }
|
322
323
|
end
|
323
|
-
end
|
324
|
-
|
325
|
-
def
|
326
|
-
a = Grouping(@table, :by => "a", :order => lambda { |g| -g.length } )
|
327
|
-
b = a.sort_grouping_by(:name)
|
328
|
-
|
329
|
-
names = %w[banana cat dog]
|
324
|
+
end
|
325
|
+
|
326
|
+
def test_specify_can_get_a_new_sorted_grouping
|
327
|
+
a = Grouping(@table, :by => "a", :order => lambda { |g| -g.length } )
|
328
|
+
b = a.sort_grouping_by(:name)
|
329
|
+
|
330
|
+
names = %w[banana cat dog]
|
330
331
|
data = [ [[8,1],[7,9]], [[3,5]], [[1,2],[5,6],[2,4]] ]
|
331
332
|
b.each do |name,group|
|
332
333
|
assert_equal names.shift, name
|
333
|
-
assert_equal data.shift, group.map { |r| r.to_a }
|
334
|
+
assert_equal data.shift, group.map { |r| r.to_a }
|
334
335
|
end
|
335
|
-
|
336
|
+
|
336
337
|
# assert original retained
|
337
|
-
names = %w[dog banana cat]
|
338
|
+
names = %w[dog banana cat]
|
338
339
|
data = [ [[1,2],[5,6],[2,4]], [[8,1],[7,9]], [[3,5]] ]
|
339
340
|
a.each do |name,group|
|
340
341
|
assert_equal names.shift, name
|
341
|
-
assert_equal data.shift, group.map { |r| r.to_a }
|
342
|
-
end
|
342
|
+
assert_equal data.shift, group.map { |r| r.to_a }
|
343
|
+
end
|
343
344
|
end
|
344
345
|
end
|
345
|
-
|
346
|
+
|
346
347
|
class MyRecord < Ruport::Data::Record; end
|
347
|
-
|
348
|
+
|
348
349
|
def test_grouping_should_set_record_class
|
349
|
-
a = Table(%w[a b c], :record_class => MyRecord) { |t|
|
350
|
+
a = Ruport.Table(%w[a b c], :record_class => MyRecord) { |t|
|
350
351
|
t << [1,2,3]
|
351
352
|
t << [4,5,6]
|
352
353
|
}
|
353
354
|
b = Ruport::Data::Grouping.new(a, :by => "a")
|
354
355
|
assert_equal MyRecord, b[1].record_class
|
355
|
-
end
|
356
|
+
end
|
356
357
|
|
357
358
|
class MyGroupingSub < Ruport::Data::Grouping; end
|
358
359
|
|
359
360
|
def test_ensure_grouping_subclasses_render_properly
|
360
|
-
t = Table(%w[a b c]) << [1,2,3]
|
361
|
-
a = MyGroupingSub.new(t, :by => "a")
|
361
|
+
t = Ruport.Table(%w[a b c]) << [1,2,3]
|
362
|
+
a = MyGroupingSub.new(t, :by => "a")
|
362
363
|
assert_equal "1\n\nb,c\n2,3\n\n", a.to_csv
|
363
364
|
end
|
364
365
|
end
|
365
366
|
|
366
|
-
class TestGroupingRendering < Test
|
367
|
+
class TestGroupingRendering < Minitest::Test
|
367
368
|
|
368
369
|
def setup
|
369
|
-
table = Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
370
|
+
table = Ruport.Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
370
371
|
@grouping = Ruport::Data::Grouping.new(table, :by => "a")
|
371
372
|
end
|
372
|
-
|
373
|
+
|
373
374
|
def test_grouping_as
|
374
|
-
assert_equal(
|
375
|
-
assert_equal(
|
376
|
-
:show_table_headers => false).
|
375
|
+
assert_equal(15, @grouping.to_text.split("\n").size)
|
376
|
+
assert_equal(11, @grouping.as(:text,
|
377
|
+
:show_table_headers => false).split("\n").size)
|
377
378
|
end
|
378
379
|
|
379
380
|
def test_as_throws_proper_errors
|
380
|
-
|
381
|
-
|
381
|
+
@grouping.as(:csv)
|
382
|
+
@grouping.to_csv
|
382
383
|
assert_raises(Ruport::Controller::UnknownFormatError) {
|
383
384
|
@grouping.as(:nothing) }
|
384
385
|
assert_raises(Ruport::Controller::UnknownFormatError) {
|
@@ -386,18 +387,18 @@ class TestGroupingRendering < Test::Unit::TestCase
|
|
386
387
|
end
|
387
388
|
end
|
388
389
|
|
389
|
-
class TestGroupingKernelHacks < Test
|
390
|
+
class TestGroupingKernelHacks < Minitest::Test
|
390
391
|
|
391
392
|
def test_group_kernel_hack
|
392
393
|
group = Ruport::Data::Group.new( :name => 'test',
|
393
394
|
:data => [[1,2,3]],
|
394
395
|
:column_names => %w[a b c])
|
395
396
|
assert_equal group, Group('test', :data => [[1,2,3]],
|
396
|
-
:column_names => %w[a b c])
|
397
|
+
:column_names => %w[a b c])
|
397
398
|
end
|
398
399
|
|
399
400
|
def test_grouping_kernel_hack
|
400
|
-
table = Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
401
|
+
table = Ruport.Table(%w[a b c], :data => [[1,2,3],[4,5,6]])
|
401
402
|
grouping = Ruport::Data::Grouping.new(table, :by => "a")
|
402
403
|
a = { 1 => Ruport::Data::Group.new( :data => [[2,3]],
|
403
404
|
:column_names => %w[b c],
|
data/test/helpers.rb
CHANGED
@@ -1,10 +1,29 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
require 'coveralls'
|
2
|
+
require 'simplecov'
|
3
|
+
require 'coveralls'
|
4
|
+
|
5
|
+
# Use this formatter instead if you want to see coverage locally:
|
6
|
+
#
|
7
|
+
# SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
8
|
+
# SimpleCov::Formatter::HTMLFormatter,
|
9
|
+
# Coveralls::SimpleCov::Formatter
|
10
|
+
# ])
|
11
|
+
|
12
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
13
|
+
SimpleCov.start do
|
14
|
+
add_filter 'test'
|
15
|
+
end
|
16
|
+
|
17
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
18
|
+
require 'ruport'
|
19
|
+
require 'minitest'
|
20
|
+
require 'minitest/autorun'
|
21
|
+
require 'minitest/spec'
|
22
|
+
require 'minitest/unit'
|
23
|
+
require 'shoulda-context'
|
24
|
+
require 'mocha/minitest'
|
25
|
+
class Minitest::Test
|
26
|
+
include Ruport
|
27
|
+
end
|
28
|
+
|
29
|
+
TEST_SAMPLES = File.join(File.expand_path(File.dirname(__FILE__)), "samples")
|