html-table 1.6.3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ ######################################################
2
+ # tablesection_spec.rb
3
+ #
4
+ # Test suite for the HTML::Table::TableSection class.
5
+ ######################################################
6
+ require 'rspec'
7
+ require 'html/table'
8
+
9
+ RSpec.describe HTML::Table::TableSection do
10
+ before do
11
+ @table = Table.new
12
+ @tsection = HTML::Table::TableSection.new
13
+ end
14
+
15
+ example "indent_level" do
16
+ expect(HTML::Table::TableSection).to respond_to(:indent_level)
17
+ expect(HTML::Table::TableSection).to respond_to(:indent_level=)
18
+ expect{ HTML::Table::TableSection.indent_level = "foo" }.to raise_error(ArgumentTypeError)
19
+ expect{ HTML::Table::TableSection.indent_level = 3 }.not_to raise_error
20
+ end
21
+
22
+ example "indices" do
23
+ expect{ @tsection[0] = "foo" }.to raise_error(ArgumentTypeError)
24
+ expect{ @tsection[0] = HTML::Table::Row.new }.not_to raise_error
25
+ end
26
+
27
+ example "push" do
28
+ expect{ @tsection.push("foo") }.to raise_error(ArgumentTypeError)
29
+ expect{ @tsection.push(HTML::Table::Row.new) }.not_to raise_error
30
+ end
31
+
32
+ example "unshift" do
33
+ expect{ @tsection.unshift("foo") }.to raise_error(ArgumentTypeError)
34
+ expect{ @tsection.unshift(HTML::Table::Row.new) }.not_to raise_error
35
+ end
36
+ end
@@ -0,0 +1,85 @@
1
+ ############################################################################
2
+ # tag_handler_spec.rb
3
+ #
4
+ # Test suite for the TagHandler module. For these tests, we'll use an
5
+ # instance of the Table class where the module has been mixed in.
6
+ ############################################################################
7
+ require 'rspec'
8
+ require 'html/table'
9
+
10
+ RSpec.describe HTML::Mixin::TagHandler do
11
+ before(:all) do
12
+ BlinkWarning.disable
13
+ end
14
+
15
+ before do
16
+ @tcontent = HTML::Table::Content.new('test')
17
+ end
18
+
19
+ example "bold" do
20
+ expect(@tcontent).to respond_to(:bold)
21
+ expect(@tcontent).to respond_to(:bold=)
22
+ expect{ @tcontent.bold }.not_to raise_error
23
+ expect{ @tcontent.bold = true }.not_to raise_error
24
+ end
25
+
26
+ example "big" do
27
+ expect(@tcontent).to respond_to(:big)
28
+ expect(@tcontent).to respond_to(:big=)
29
+ expect{ @tcontent.big }.not_to raise_error
30
+ expect{ @tcontent.big = true }.not_to raise_error
31
+ end
32
+
33
+ example "blink" do
34
+ expect(@tcontent).to respond_to(:blink)
35
+ expect(@tcontent).to respond_to(:blink=)
36
+ expect{ @tcontent.blink }.not_to raise_error
37
+ expect{ @tcontent.blink = true }.not_to raise_error
38
+ end
39
+
40
+ example "italic" do
41
+ expect(@tcontent).to respond_to(:italic)
42
+ expect(@tcontent).to respond_to(:italic=)
43
+ expect{ @tcontent.italic }.not_to raise_error
44
+ expect{ @tcontent.italic = true }.not_to raise_error
45
+ end
46
+
47
+ example "strike" do
48
+ expect(@tcontent).to respond_to(:strike)
49
+ expect(@tcontent).to respond_to(:strike=)
50
+ expect{ @tcontent.strike }.not_to raise_error
51
+ expect{ @tcontent.strike = true }.not_to raise_error
52
+ end
53
+
54
+ example "sub" do
55
+ expect(@tcontent).to respond_to(:sub)
56
+ expect(@tcontent).to respond_to(:sub)
57
+ expect{ @tcontent.sub }.not_to raise_error
58
+ expect{ @tcontent.sub = true }.not_to raise_error
59
+ end
60
+
61
+ example "sup" do
62
+ expect(@tcontent).to respond_to(:sup)
63
+ expect(@tcontent).to respond_to(:sup)
64
+ expect{ @tcontent.sup }.not_to raise_error
65
+ expect{ @tcontent.sup = true }.not_to raise_error
66
+ end
67
+
68
+ example "tt" do
69
+ expect(@tcontent).to respond_to(:tt)
70
+ expect(@tcontent).to respond_to(:tt)
71
+ expect{ @tcontent.tt }.not_to raise_error
72
+ expect{ @tcontent.tt = true }.not_to raise_error
73
+ end
74
+
75
+ example "underline" do
76
+ expect(@tcontent).to respond_to(:underline)
77
+ expect(@tcontent).to respond_to(:underline)
78
+ expect{ @tcontent.underline }.not_to raise_error
79
+ expect{ @tcontent.underline = true }.not_to raise_error
80
+ end
81
+
82
+ after(:all) do
83
+ BlinkWarning.enable
84
+ end
85
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-table
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,7 +35,7 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date:
38
+ date:
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: structured_warnings
@@ -43,28 +43,28 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.3.0
46
+ version: 0.4.0
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 0.3.0
53
+ version: 0.4.0
54
54
  - !ruby/object:Gem::Dependency
55
- name: test-unit
55
+ name: rspec
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0'
60
+ version: '3.9'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '3.9'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: rake
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -104,21 +104,21 @@ extra_rdoc_files:
104
104
  files:
105
105
  - html-table.gemspec
106
106
  - LICENSE
107
- - test
108
- - test/test_col.rb
109
- - test/test_colgroup.rb
110
- - test/test_data.rb
111
- - test/test_caption.rb
112
- - test/test_header.rb
113
- - test/test_head.rb
114
- - test/test_row.rb
115
- - test/test_attribute_handler.rb
116
- - test/test_table.rb
117
- - test/test_foot.rb
118
- - test/test_html_handler.rb
119
- - test/test_tablesection.rb
120
- - test/test_tag_handler.rb
121
- - test/test_body.rb
107
+ - spec
108
+ - spec/tag_handler_spec.rb
109
+ - spec/attribute_handler_spec.rb
110
+ - spec/colgroup_spec.rb
111
+ - spec/caption_spec.rb
112
+ - spec/row_spec.rb
113
+ - spec/head_spec.rb
114
+ - spec/colgroup_col_spec.rb
115
+ - spec/data_spec.rb
116
+ - spec/header_spec.rb
117
+ - spec/body_spec.rb
118
+ - spec/html_handler_spec.rb
119
+ - spec/table_spec.rb
120
+ - spec/tablesection_spec.rb
121
+ - spec/foot_spec.rb
122
122
  - Rakefile
123
123
  - certs
124
124
  - certs/djberg96_pub.pem
@@ -151,6 +151,7 @@ files:
151
151
  - lib/html/header.rb
152
152
  - lib/html-table.rb
153
153
  - CHANGES.rdoc
154
+ - Gemfile
154
155
  - doc
155
156
  - doc/table_colgroup_col.rdoc
156
157
  - doc/table_colgroup.rdoc
@@ -176,7 +177,7 @@ metadata:
176
177
  documentation_uri: https://github.com/djberg96/html-table/wiki
177
178
  source_code_uri: https://github.com/djberg96/html-table
178
179
  wiki_uri: https://github.com/djberg96/html-table/wiki
179
- post_install_message:
180
+ post_install_message:
180
181
  rdoc_options: []
181
182
  require_paths:
182
183
  - lib
@@ -191,22 +192,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
192
  - !ruby/object:Gem::Version
192
193
  version: '0'
193
194
  requirements: []
194
- rubygems_version: 3.0.6
195
- signing_key:
195
+ rubygems_version: 3.1.4
196
+ signing_key:
196
197
  specification_version: 4
197
198
  summary: A Ruby interface for generating HTML tables
198
199
  test_files:
199
- - test/test_col.rb
200
- - test/test_colgroup.rb
201
- - test/test_data.rb
202
- - test/test_caption.rb
203
- - test/test_header.rb
204
- - test/test_head.rb
205
- - test/test_row.rb
206
- - test/test_attribute_handler.rb
207
- - test/test_table.rb
208
- - test/test_foot.rb
209
- - test/test_html_handler.rb
210
- - test/test_tablesection.rb
211
- - test/test_tag_handler.rb
212
- - test/test_body.rb
200
+ - spec/tag_handler_spec.rb
201
+ - spec/attribute_handler_spec.rb
202
+ - spec/colgroup_spec.rb
203
+ - spec/caption_spec.rb
204
+ - spec/row_spec.rb
205
+ - spec/head_spec.rb
206
+ - spec/colgroup_col_spec.rb
207
+ - spec/data_spec.rb
208
+ - spec/header_spec.rb
209
+ - spec/body_spec.rb
210
+ - spec/html_handler_spec.rb
211
+ - spec/table_spec.rb
212
+ - spec/tablesection_spec.rb
213
+ - spec/foot_spec.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,361 +0,0 @@
1
- ############################################################################
2
- # test_attribute_handler.rb
3
- #
4
- # Test suite for the AttributeHandler module. For these tests, we'll use an
5
- # instance of the Table class where the module has been mixed in.
6
- ############################################################################
7
- require 'test-unit'
8
- require 'html/table'
9
- include HTML
10
-
11
- class TC_AttributeHandler < Test::Unit::TestCase
12
- def self.startup
13
- NonStandardExtensionWarning.disable
14
- end
15
-
16
- def setup
17
- @table = Table.new(['foo',1,'bar'])
18
- end
19
-
20
- def test_abbr_basic
21
- assert_respond_to(@table, :abbr)
22
- assert_respond_to(@table, :abbr=)
23
- end
24
-
25
- def test_abbr
26
- assert_nothing_raised{ @table.abbr }
27
- assert_nil(@table.abbr)
28
- assert_nothing_raised{ @table.abbr = 'foo' }
29
- assert_equal('foo', @table.abbr)
30
- end
31
-
32
- def test_align_basic
33
- assert_respond_to(@table, :align)
34
- assert_respond_to(@table, :align=)
35
- end
36
-
37
- def test_align
38
- assert_nothing_raised{ @table.align }
39
- assert_nil(@table.align)
40
- assert_nothing_raised{ @table.align = 'center' }
41
- assert_equal('center', @table.align)
42
- end
43
-
44
- def test_align_expected_errors
45
- assert_raises(ArgumentError){ @table.align = 'foo' }
46
- end
47
-
48
- def test_axis
49
- assert_respond_to(@table, :axis)
50
- assert_respond_to(@table, :axis=)
51
- assert_nothing_raised{ @table.axis }
52
- assert_nothing_raised{ @table.axis = 'foo' }
53
- end
54
-
55
- def test_background_basic
56
- assert_respond_to(@table, :background)
57
- assert_respond_to(@table, :background=)
58
- end
59
-
60
- def test_background
61
- assert_nothing_raised{ @table.background }
62
- assert_nil(@table.background)
63
- assert_nothing_raised{ @table.background = 'foo' }
64
- assert_equal('foo', @table.background)
65
- end
66
-
67
- def test_background_expected_errors
68
- assert_raises(TypeError){ @table.background = 1 }
69
- end
70
-
71
- def test_bgcolor_basic
72
- assert_respond_to(@table, :bgcolor)
73
- assert_respond_to(@table, :bgcolor=)
74
- end
75
-
76
- def test_bgcolor
77
- assert_nothing_raised{ @table.bgcolor }
78
- assert_nil(@table.bgcolor)
79
- assert_nothing_raised{ @table.bgcolor = 'foo' }
80
- assert_equal('foo', @table.bgcolor)
81
- end
82
-
83
- def test_border_basic
84
- assert_respond_to(@table, :border)
85
- assert_respond_to(@table, :border=)
86
- end
87
-
88
- def test_border
89
- assert_nothing_raised{ @table.border }
90
- assert_nothing_raised{ @table.border = 2 }
91
- assert_nothing_raised{ @table.border = true }
92
- assert_nothing_raised{ @table.border = false }
93
- end
94
-
95
- def test_bordercolor_basic
96
- assert_respond_to(@table, :bordercolor)
97
- assert_respond_to(@table, :bordercolor=)
98
- end
99
-
100
- def test_bordercolor
101
- assert_nothing_raised{ @table.bordercolor }
102
- assert_nil(@table.bordercolor)
103
- assert_nothing_raised{ @table.bordercolor = 'foo' }
104
- assert_equal('foo', @table.bordercolor)
105
- end
106
-
107
- def test_bordercolordark_basic
108
- assert_respond_to(@table, :bordercolordark)
109
- assert_respond_to(@table, :bordercolordark=)
110
- end
111
-
112
- def test_bordercolordark
113
- assert_nothing_raised{ @table.bordercolordark }
114
- assert_nil(@table.bordercolordark)
115
- assert_nothing_raised{ @table.bordercolordark = 'foo' }
116
- assert_equal('foo', @table.bordercolordark)
117
- end
118
-
119
- def test_bordercolorlight
120
- assert_respond_to(@table, :bordercolorlight)
121
- assert_respond_to(@table, :bordercolorlight=)
122
- assert_nothing_raised{ @table.bordercolorlight }
123
- assert_nothing_raised{ @table.bordercolorlight = 'foo' }
124
- end
125
-
126
- def test_cellpadding
127
- assert_respond_to(@table, :cellpadding)
128
- assert_respond_to(@table, :cellpadding=)
129
- assert_nothing_raised{ @table.cellpadding }
130
- assert_nothing_raised{ @table.cellpadding = 1 }
131
- end
132
-
133
- def test_cellpadding_expected_errors
134
- assert_raises(ArgumentError){ @table.cellpadding = -1 }
135
- end
136
-
137
- def test_cellspacing
138
- assert_respond_to(@table, :cellspacing)
139
- assert_respond_to(@table, :cellspacing=)
140
- assert_nothing_raised{ @table.cellspacing }
141
- assert_nothing_raised{ @table.cellspacing = 1 }
142
- end
143
-
144
- def test_cellspacing_expected_errors
145
- assert_raises(ArgumentError){ @table.cellspacing = -1 }
146
- end
147
-
148
- def test_char
149
- assert_respond_to(@table, :char)
150
- assert_respond_to(@table, :char=)
151
- assert_nothing_raised{ @table.char }
152
- assert_nothing_raised{ @table.char = 'x' }
153
- end
154
-
155
- def test_char_expected_errors
156
- assert_raises(ArgumentError){ @table.char = 'xx' }
157
- end
158
-
159
- def test_charoff
160
- assert_respond_to(@table, :charoff)
161
- assert_respond_to(@table, :charoff=)
162
- assert_nothing_raised{ @table.charoff }
163
- assert_nothing_raised{ @table.charoff = 1 }
164
- end
165
-
166
- def test_charoff_expected_errors
167
- assert_raises(ArgumentError){ @table.charoff = -1 }
168
- end
169
-
170
- def test_class
171
- assert_respond_to(@table, :class_)
172
- assert_respond_to(@table, :class_=)
173
- assert_nothing_raised{ @table.class_ }
174
- assert_nothing_raised{ @table.class_ = 'myclass' }
175
- end
176
-
177
- def test_col
178
- assert_respond_to(@table, :col)
179
- assert_respond_to(@table, :col=)
180
- assert_nothing_raised{ @table.col }
181
- assert_nothing_raised{ @table.col = 1 }
182
- end
183
-
184
- def test_col_expected_errors
185
- assert_raises(ArgumentError){ @table.col = -1 }
186
- end
187
-
188
- def test_colspan
189
- assert_respond_to(@table, :colspan)
190
- assert_respond_to(@table, :colspan=)
191
- assert_nothing_raised{ @table.colspan }
192
- assert_nothing_raised{ @table.colspan = 1 }
193
- end
194
-
195
- def test_colspan_expected_errors
196
- assert_raises(ArgumentError){ @table.colspan = -1 }
197
- end
198
-
199
- def test_configure
200
- assert_respond_to(@table, :configure)
201
- assert_nothing_raised{ @table.configure(0){} }
202
- assert_nothing_raised{ @table.configure(0,0){} }
203
- end
204
-
205
- def test_configure_expected_errors
206
- assert_raises(ArgumentError){ @table.configure(0,0,0){} }
207
- end
208
-
209
- ########################################################################
210
- # This test could probably be broken out into separate tests for each
211
- # type that we want to add as content.
212
- ########################################################################
213
- def test_content
214
- assert_respond_to(@table, :content)
215
- assert_respond_to(@table, :content=)
216
- assert_nothing_raised{ @table.content = 'foo' }
217
- assert_nothing_raised{ @table.content = 123 }
218
- assert_nothing_raised{ @table.content = ['one',2,'three'] }
219
- assert_nothing_raised{ @table.content = [['foo','bar'],[1,2,3]] }
220
- assert_nothing_raised{ @table.content = Table::Row.new }
221
- assert_nothing_raised{ @table.content = Table::Row::Data.new }
222
- assert_nothing_raised{ @table.content = Table::Row::Header.new }
223
- assert_nothing_raised{ @table.content = Table::Head.create }
224
- assert_nothing_raised{ @table.content = Table::Foot.create }
225
- assert_nothing_raised{ @table.content = Table::Body.new }
226
- end
227
-
228
- def test_frame
229
- assert_respond_to(@table, :frame)
230
- assert_respond_to(@table, :frame=)
231
- assert_nothing_raised{ @table.frame }
232
- assert_nothing_raised{ @table.frame = 'below' }
233
- end
234
-
235
- def test_frame_expected_errors
236
- assert_raises(ArgumentError){ @table.frame = 'foo' }
237
- end
238
-
239
- def test_height
240
- assert_respond_to(@table, :height)
241
- assert_respond_to(@table, :height=)
242
- assert_nothing_raised{ @table.height }
243
- assert_nothing_raised{ @table.height = 1 }
244
- end
245
-
246
- def test_height_expected_errors
247
- assert_raises(ArgumentError){ @table.height = -1 }
248
- end
249
-
250
- def test_hspace
251
- assert_respond_to(@table, :hspace)
252
- assert_respond_to(@table, :hspace=)
253
- assert_nothing_raised{ @table.hspace }
254
- assert_nothing_raised{ @table.hspace = 1 }
255
- end
256
-
257
- def test_hspace_expected_errors
258
- assert_raises(ArgumentError){ @table.hspace = -1 }
259
- end
260
-
261
- def test_nowrap
262
- assert_respond_to(@table, :nowrap)
263
- assert_respond_to(@table, :nowrap=)
264
- assert_nothing_raised{ @table.nowrap }
265
- assert_nothing_raised{ @table.nowrap = false }
266
- end
267
-
268
- def test_nowrap_expected_errors
269
- assert_raises(TypeError){ @table.nowrap = 'foo' }
270
- end
271
-
272
- def test_rowspan
273
- assert_respond_to(@table, :rowspan)
274
- assert_respond_to(@table, :rowspan=)
275
- assert_nothing_raised{ @table.rowspan }
276
- assert_nothing_raised{ @table.rowspan = 1 }
277
- end
278
-
279
- def test_rowspan_expected_errors
280
- assert_raises(ArgumentError){ @table.rowspan = -1 }
281
- end
282
-
283
- def test_rules
284
- assert_respond_to(@table, :rules)
285
- assert_respond_to(@table, :rules=)
286
- assert_nothing_raised{ @table.rules }
287
- assert_nothing_raised{ @table.rules = 'all' }
288
- end
289
-
290
- def test_rules_expected_errors
291
- assert_raises(ArgumentError){ @table.rules = 'foo' }
292
- end
293
-
294
- def test_span
295
- assert_respond_to(@table, :span)
296
- assert_respond_to(@table, :span=)
297
- assert_nothing_raised{ @table.span }
298
- assert_nothing_raised{ @table.span = 1 }
299
- end
300
-
301
- def test_span_expected_errors
302
- assert_raises(ArgumentError){ @table.span = -1 }
303
- end
304
-
305
- def test_style
306
- assert_respond_to(@table, :style)
307
- assert_respond_to(@table, :style=)
308
- assert_nothing_raised{ @table.style }
309
- assert_nothing_raised{ @table.style = 'color: blue' }
310
- end
311
-
312
- def test_summary
313
- assert_respond_to(@table, :summary)
314
- assert_respond_to(@table, :summary=)
315
- assert_nothing_raised{ @table.summary }
316
- assert_nothing_raised{ @table.summary = 'foo' }
317
- assert_nothing_raised{ @table.summary = 1 }
318
- end
319
-
320
- def test_valign
321
- assert_respond_to(@table, :valign)
322
- assert_respond_to(@table, :valign=)
323
- assert_nothing_raised{ @table.valign }
324
- assert_nothing_raised{ @table.valign = 'center' }
325
- end
326
-
327
- def test_valign_expected_errors
328
- assert_raises(ArgumentError){ @table.valign = 'foo' }
329
- end
330
-
331
- def test_vspace
332
- assert_respond_to(@table, :vspace)
333
- assert_respond_to(@table, :vspace=)
334
- assert_nothing_raised{ @table.vspace }
335
- assert_nothing_raised{ @table.vspace = 1 }
336
- end
337
-
338
- def test_vspace_expected_errors
339
- assert_raises(ArgumentError){ @table.vspace = -1 }
340
- end
341
-
342
- def test_width
343
- assert_respond_to(@table, :width)
344
- assert_respond_to(@table, :width=)
345
- assert_nothing_raised{ @table.width}
346
- assert_nothing_raised{ @table.width = 10 }
347
- assert_nothing_raised{ @table.width = '5%' }
348
- end
349
-
350
- def test_width_expected_errors
351
- assert_raises(ArgumentError){ @table.width = -1 }
352
- end
353
-
354
- def teardown
355
- @table = nil
356
- end
357
-
358
- def self.shutdown
359
- NonStandardExtensionWarning.enable
360
- end
361
- end