rorschart 0.14.0 → 0.14.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rorschart/data/pivot_series.rb +2 -2
- data/lib/rorschart/data/rorschart_data.rb +2 -0
- data/lib/rorschart/version.rb +1 -1
- data/test/data/pivot_series_test.rb +17 -29
- data/test/google_chart_mapper_test.rb +49 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8338cccb4eb12fd8f27b2545ba1faed1fc25446b
|
4
|
+
data.tar.gz: 3d028514499cd58bed636e4ae650941d74805e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a49bb6d41b963b115298aa302a539bf2402ccbd7254576b0c8d0a39b26e8b399f4a28d68b9245dc1e82c422a282e4efe2808438c314f39542d6ed9eea68ddd4
|
7
|
+
data.tar.gz: 2b0972e87e6f15ac1aa521c1aed5650566ddb09892428714baedc1207011a8c0be4aea00907ebfdde7ed68fbe68d011d70e46469b8469f358671a1c932cddc7e
|
data/Gemfile.lock
CHANGED
@@ -22,9 +22,9 @@ module Rorschart
|
|
22
22
|
}
|
23
23
|
|
24
24
|
#cols
|
25
|
-
type = rorschart_serie.cols[2][:type]
|
25
|
+
type = rorschart_serie.cols[2][:type] rescue nil
|
26
26
|
@cols = []
|
27
|
-
@cols << rorschart_serie.cols[0]
|
27
|
+
@cols << rorschart_serie.cols[0] rescue nil
|
28
28
|
row_nil.keys.each { |r|
|
29
29
|
@cols << { :type => type, :label => r }
|
30
30
|
}
|
data/lib/rorschart/version.rb
CHANGED
@@ -42,37 +42,25 @@ module Rorschart
|
|
42
42
|
assert_equal expected_rows, pivot_series.rows
|
43
43
|
|
44
44
|
end
|
45
|
-
|
46
|
-
# def test_convert_numeric_grouped_dy_date_and_multiple_fields_into_multiseries
|
47
|
-
|
48
|
-
# # Given
|
49
|
-
# data = [
|
50
|
-
# {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "A", "count"=> 1},
|
51
|
-
# {"collector_tstamp"=> Date.parse("2013-11-02"), "series" => "B", "count"=> 2},
|
52
|
-
# {"collector_tstamp"=> Date.parse("2013-12-01"), "series" => "A", "count"=> 3},
|
53
|
-
# {"collector_tstamp"=> Date.parse("2013-12-01"), "series" => "B", "count"=> 4}
|
54
|
-
# ]
|
55
|
-
|
56
|
-
# # When
|
57
|
-
# dataTable = to_datatable_format(data)
|
58
|
-
|
59
|
-
# # Then
|
60
|
-
# excepted = {
|
61
|
-
# cols: [
|
62
|
-
# {type: 'date', label: 'collector_tstamp'},
|
63
|
-
# {type: 'number', label: 'A'},
|
64
|
-
# {type: 'number', label: 'B'}
|
65
|
-
# ],
|
66
|
-
# rows: [
|
67
|
-
# {c:[{v: Date.parse("2013-11-02")}, {v: 1}, {v: 2}]},
|
68
|
-
# {c:[{v: Date.parse("2013-12-01")}, {v: 3}, {v: 4}]}
|
69
|
-
# ]
|
70
|
-
# }
|
71
|
-
|
72
|
-
# compare_dataTable excepted, dataTable
|
73
|
-
# end
|
74
45
|
|
46
|
+
def test_pivot_with_empty_data
|
47
|
+
|
48
|
+
# Given
|
49
|
+
data = []
|
50
|
+
|
51
|
+
# When
|
52
|
+
|
53
|
+
pivot_series = PivotSeries.new(data)
|
54
|
+
|
55
|
+
# assert
|
56
|
+
expected_cols = []
|
57
|
+
|
58
|
+
expected_rows = []
|
75
59
|
|
60
|
+
assert_equal expected_cols, pivot_series.cols
|
61
|
+
assert_equal expected_rows, pivot_series.rows
|
62
|
+
end
|
63
|
+
|
76
64
|
end
|
77
65
|
|
78
66
|
end
|
@@ -6,9 +6,13 @@ class TestGoogleChartMapper < Minitest::Unit::TestCase
|
|
6
6
|
include Rorschart::GoogleChart::Mapper
|
7
7
|
|
8
8
|
def compare_dataTable(right, left)
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
if (right[:cols] == nil) || (left == left[:cols])
|
10
|
+
assert_equal right.to_json, left.to_json
|
11
|
+
else
|
12
|
+
assert_equal right[:cols], left[:cols]
|
13
|
+
assert_equal right[:cols].count, left[:cols].count
|
14
|
+
assert_equal right.to_json, left.to_json
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
def test_from_a_simple_hash_and_detect_type_and_name
|
@@ -268,6 +272,29 @@ class TestGoogleChartMapper < Minitest::Unit::TestCase
|
|
268
272
|
|
269
273
|
end
|
270
274
|
|
275
|
+
def test_merge_multiple_empty_series
|
276
|
+
|
277
|
+
# Given
|
278
|
+
serie1 = []
|
279
|
+
|
280
|
+
serie2 = []
|
281
|
+
|
282
|
+
data = Rorschart::MultipleSeries.new [serie1, serie2]
|
283
|
+
|
284
|
+
# When
|
285
|
+
series = to_datatable_format(data)
|
286
|
+
|
287
|
+
# Then
|
288
|
+
excepted = {
|
289
|
+
cols: [],
|
290
|
+
rows: []
|
291
|
+
}
|
292
|
+
|
293
|
+
compare_dataTable excepted, series
|
294
|
+
|
295
|
+
end
|
296
|
+
|
297
|
+
|
271
298
|
def test_merge_two_series_with_first_serie_start_later
|
272
299
|
|
273
300
|
# Given
|
@@ -309,6 +336,25 @@ class TestGoogleChartMapper < Minitest::Unit::TestCase
|
|
309
336
|
|
310
337
|
end
|
311
338
|
|
339
|
+
|
340
|
+
def test_empty_data
|
341
|
+
|
342
|
+
# Given
|
343
|
+
data = []
|
344
|
+
|
345
|
+
# When
|
346
|
+
dataTable = to_datatable_format(data)
|
347
|
+
|
348
|
+
# Then
|
349
|
+
excepted = {
|
350
|
+
cols: nil,
|
351
|
+
rows: []
|
352
|
+
}
|
353
|
+
|
354
|
+
compare_dataTable excepted, dataTable
|
355
|
+
|
356
|
+
end
|
357
|
+
|
312
358
|
# def test_convert_numeric_grouped_dy_date_and_another_field_into_multiseries
|
313
359
|
|
314
360
|
# # Given
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rorschart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Pantera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|