panic_board_data 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ require 'csv'
2
+
3
+ module PanicBoardData
4
+ class Table
5
+
6
+ def to_html
7
+ Object
8
+ end
9
+
10
+ def self.to_csv data
11
+ ::CSV.generate do |csv|
12
+ data.each { |row| csv << row }
13
+ end.strip
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module PanicBoardData
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,63 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe PanicBoardData::Table do
4
+ it "should exist" do
5
+ PanicBoardData::Table.nil?.must_equal false
6
+ end
7
+
8
+ describe "to_html" do
9
+
10
+ let(:table) { PanicBoardData::Table.new }
11
+
12
+ before do
13
+ @result = table.to_html
14
+ end
15
+
16
+ it "should return a result" do
17
+ @result.nil?.must_equal false
18
+ end
19
+
20
+ end
21
+
22
+ describe "to_csv" do
23
+
24
+ before do
25
+ @result = PanicBoardData::Table.to_csv data
26
+ end
27
+
28
+ describe "an empty set" do
29
+ let(:data) { [] }
30
+
31
+ it "should return an empty string" do
32
+ @result.must_equal ''
33
+ end
34
+ end
35
+
36
+ [:array, :result].to_objects { [
37
+ [ [0], "0" ],
38
+ [ [1], "1" ],
39
+ [ [1,2], "1,2" ],
40
+ [ [3,4, '"'], "3,4,\"\"\"\"" ]
41
+ ] }.each do |test|
42
+ describe "one row" do
43
+ let(:data) { [ test.array ] }
44
+
45
+ it "should return the single value" do
46
+ @result.must_equal test.result
47
+ end
48
+ end
49
+ end
50
+
51
+ [:first_row, :second_row, :result].to_objects { [
52
+ [ [0], [1], "0\n1" ],
53
+ ] }.each do |test|
54
+ describe "two rows" do
55
+ let(:data) { [ test.first_row, test.second_row ] }
56
+
57
+ it "should return the single value" do
58
+ @result.must_equal test.result
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panic_board_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-06 00:00:00.000000000 Z
12
+ date: 2013-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -122,9 +122,11 @@ files:
122
122
  - lib/panic_board_data.rb
123
123
  - lib/panic_board_data/data_sequence.rb
124
124
  - lib/panic_board_data/graph.rb
125
+ - lib/panic_board_data/table.rb
125
126
  - lib/panic_board_data/version.rb
126
127
  - panic_board_data.gemspec
127
128
  - spec/panic_board_data/graph_spec.rb
129
+ - spec/panic_board_data/table_spec.rb
128
130
  - spec/spec_helper.rb
129
131
  homepage: ''
130
132
  licenses:
@@ -141,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
143
  version: '0'
142
144
  segments:
143
145
  - 0
144
- hash: -3334913484776755300
146
+ hash: 1218767115375863047
145
147
  required_rubygems_version: !ruby/object:Gem::Requirement
146
148
  none: false
147
149
  requirements:
@@ -150,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
152
  version: '0'
151
153
  segments:
152
154
  - 0
153
- hash: -3334913484776755300
155
+ hash: 1218767115375863047
154
156
  requirements: []
155
157
  rubyforge_project:
156
158
  rubygems_version: 1.8.25
@@ -159,4 +161,5 @@ specification_version: 3
159
161
  summary: Export data for Panic Board
160
162
  test_files:
161
163
  - spec/panic_board_data/graph_spec.rb
164
+ - spec/panic_board_data/table_spec.rb
162
165
  - spec/spec_helper.rb