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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES.rdoc +4 -0
- data/Gemfile +7 -0
- data/MANIFEST.rdoc +18 -17
- data/Rakefile +117 -146
- data/html-table.gemspec +4 -4
- data/lib/html/mixin/attribute_handler.rb +2 -2
- data/lib/html/table.rb +1 -1
- data/spec/attribute_handler_spec.rb +360 -0
- data/spec/body_spec.rb +81 -0
- data/spec/caption_spec.rb +74 -0
- data/spec/colgroup_col_spec.rb +34 -0
- data/spec/colgroup_spec.rb +83 -0
- data/spec/data_spec.rb +72 -0
- data/spec/foot_spec.rb +104 -0
- data/spec/head_spec.rb +101 -0
- data/spec/header_spec.rb +72 -0
- data/spec/html_handler_spec.rb +32 -0
- data/spec/row_spec.rb +136 -0
- data/spec/table_spec.rb +152 -0
- data/spec/tablesection_spec.rb +36 -0
- data/spec/tag_handler_spec.rb +85 -0
- metadata +43 -42
- metadata.gz.sig +0 -0
- data/test/test_attribute_handler.rb +0 -361
- data/test/test_body.rb +0 -87
- data/test/test_caption.rb +0 -80
- data/test/test_col.rb +0 -40
- data/test/test_colgroup.rb +0 -89
- data/test/test_data.rb +0 -77
- data/test/test_foot.rb +0 -111
- data/test/test_head.rb +0 -104
- data/test/test_header.rb +0 -77
- data/test/test_html_handler.rb +0 -37
- data/test/test_row.rb +0 -141
- data/test/test_table.rb +0 -159
- data/test/test_tablesection.rb +0 -42
- data/test/test_tag_handler.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8c1474767e4e76fd82d8e8dcaa3491d27a534ffc0579fde0ec2c5937ff65a94
|
4
|
+
data.tar.gz: 2d430751276ec4ba09da083f4717dea9a67b8681d9723925ab365ee0a49bc966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3de452df4f98b15f7be7acb6dedd1a2bc8df8e6e3993740c3e84d292355978fb4db2ec8a251a5aca6bcca795084af9baaed9fa37805e9e26ae6142e8b09c5cf1
|
7
|
+
data.tar.gz: 313c1242ece38004aa7090695beb6d125b0ee17b968eb902a4321cd7926bec0bfc3c488c698a297b957af250c726b7ad6d7790795719d65a0d5c15224dfb17f0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES.rdoc
CHANGED
data/Gemfile
ADDED
data/MANIFEST.rdoc
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
* LICENSE
|
3
3
|
* MANIFEST
|
4
4
|
* README
|
5
|
+
* Gemfile
|
5
6
|
* Rakefile
|
6
7
|
* html-table.gemspec
|
7
8
|
* certs/djberg96_pub.pem
|
@@ -25,8 +26,6 @@
|
|
25
26
|
* doc/examples/simple2.rb
|
26
27
|
* doc/examples/simple3.rb
|
27
28
|
* lib/html-table.rb
|
28
|
-
* lib/strongtyping.rb
|
29
|
-
* lib/html/attribute_handler.rb
|
30
29
|
* lib/html/body.rb
|
31
30
|
* lib/html/caption.rb
|
32
31
|
* lib/html/col.rb
|
@@ -36,21 +35,23 @@
|
|
36
35
|
* lib/html/foot.rb
|
37
36
|
* lib/html/head.rb
|
38
37
|
* lib/html/header.rb
|
39
|
-
* lib/html/html_handler.rb
|
40
38
|
* lib/html/row.rb
|
41
39
|
* lib/html/table.rb
|
42
40
|
* lib/html/tablesection.rb
|
43
|
-
* lib/html/
|
44
|
-
*
|
45
|
-
*
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
50
|
-
*
|
51
|
-
*
|
52
|
-
*
|
53
|
-
*
|
54
|
-
*
|
55
|
-
*
|
56
|
-
*
|
41
|
+
* lib/html/mixin/attribute_handler.rb
|
42
|
+
* lib/html/mixin/html_handler.rb
|
43
|
+
* lib/html/mixin/strongtyping.rb
|
44
|
+
* lib/html/mixin/tag_handler.rb
|
45
|
+
* spec/attribute_handler_spec.rb
|
46
|
+
* spec/body_spec.rb
|
47
|
+
* spec/caption_spec.rb
|
48
|
+
* spec/col_spec.rb
|
49
|
+
* spec/colgroup_col_spec.rb
|
50
|
+
* spec/data_spec.rb
|
51
|
+
* spec/head_spec.rb
|
52
|
+
* spec/header_spec.rb
|
53
|
+
* spec/html_handler_spec.rb
|
54
|
+
* spec/row_spec.rb
|
55
|
+
* spec/table_spec.rb
|
56
|
+
* spec/tablesection_spec.rb
|
57
|
+
* spec/tag_handler_spec.rb
|
data/Rakefile
CHANGED
@@ -1,146 +1,117 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require '
|
4
|
-
|
5
|
-
CLEAN.include("**/*.gem", "**/*.rbc")
|
6
|
-
|
7
|
-
namespace :gem do
|
8
|
-
desc 'Build the html-table gem'
|
9
|
-
task :create => [:clean] do
|
10
|
-
require 'rubygems/package'
|
11
|
-
spec = eval(IO.read('html-table.gemspec'))
|
12
|
-
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
13
|
-
Gem::Package.build(spec, true)
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "Install the html-table package as a gem"
|
17
|
-
task :install => [:create] do
|
18
|
-
file = Dir["*.gem"].first
|
19
|
-
sh "gem install -l #{file}"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
namespace 'example' do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
t.
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
t.
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
t.
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
t.
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
t.test_files = FileList['test/test_html_handler.rb']
|
119
|
-
end
|
120
|
-
|
121
|
-
Rake::TestTask.new('row') do |t|
|
122
|
-
t.warning = true
|
123
|
-
t.verbose = true
|
124
|
-
t.test_files = FileList['test/test_row.rb']
|
125
|
-
end
|
126
|
-
|
127
|
-
Rake::TestTask.new('table') do |t|
|
128
|
-
t.warning = true
|
129
|
-
t.verbose = true
|
130
|
-
t.test_files = FileList['test/test_table.rb']
|
131
|
-
end
|
132
|
-
|
133
|
-
Rake::TestTask.new('tablesection') do |t|
|
134
|
-
t.warning = true
|
135
|
-
t.verbose = true
|
136
|
-
t.test_files = FileList['test/test_tablesection.rb']
|
137
|
-
end
|
138
|
-
|
139
|
-
Rake::TestTask.new('tag_handler') do |t|
|
140
|
-
t.warning = true
|
141
|
-
t.verbose = true
|
142
|
-
t.test_files = FileList['test/test_tag_handler.rb']
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
task :default => :test
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
CLEAN.include("**/*.gem", "**/*.rbc", "**/*.lock")
|
6
|
+
|
7
|
+
namespace :gem do
|
8
|
+
desc 'Build the html-table gem'
|
9
|
+
task :create => [:clean] do
|
10
|
+
require 'rubygems/package'
|
11
|
+
spec = eval(IO.read('html-table.gemspec'))
|
12
|
+
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
13
|
+
Gem::Package.build(spec, true)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Install the html-table package as a gem"
|
17
|
+
task :install => [:create] do
|
18
|
+
file = Dir["*.gem"].first
|
19
|
+
sh "gem install -l #{file}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
namespace 'example' do
|
24
|
+
desc "Run the first simple html-table example"
|
25
|
+
task :simple1 do
|
26
|
+
sh 'ruby -Ilib examples/simple1.rb'
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Run the second simple html-table example"
|
30
|
+
task :simple2 do
|
31
|
+
sh 'ruby -Ilib examples/simple2.rb'
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Run the third simple html-table example"
|
35
|
+
task :simple3 do
|
36
|
+
sh 'ruby -Ilib examples/simple3.rb'
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Run the first intermediate html-table example"
|
40
|
+
task :intermediate1 do
|
41
|
+
sh 'ruby -Ilib examples/intermediate1.rb'
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Run the second intermediate html-table example"
|
45
|
+
task :intermediate2 do
|
46
|
+
sh 'ruby -Ilib examples/intermediate2.rb'
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Run the advanced html-table example"
|
50
|
+
task :advanced do
|
51
|
+
sh 'ruby -Ilib examples/advanced.rb'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
namespace :spec do
|
56
|
+
RSpec::Core::RakeTask.new(:attribute_handler) do |t|
|
57
|
+
t.pattern = 'spec/attribute_handler_spec.rb'
|
58
|
+
end
|
59
|
+
|
60
|
+
RSpec::Core::RakeTask.new(:body) do |t|
|
61
|
+
t.pattern = 'spec/body_spec.rb'
|
62
|
+
end
|
63
|
+
|
64
|
+
RSpec::Core::RakeTask.new(:caption) do |t|
|
65
|
+
t.pattern = 'spec/caption_spec.rb'
|
66
|
+
end
|
67
|
+
|
68
|
+
RSpec::Core::RakeTask.new(:col) do |t|
|
69
|
+
t.pattern = 'spec/col_spec.rb'
|
70
|
+
end
|
71
|
+
|
72
|
+
RSpec::Core::RakeTask.new(:colgroup) do |t|
|
73
|
+
t.pattern = 'spec/colgroup_spec.rb'
|
74
|
+
end
|
75
|
+
|
76
|
+
RSpec::Core::RakeTask.new(:data) do |t|
|
77
|
+
t.pattern = 'spec/data_spec.rb'
|
78
|
+
end
|
79
|
+
|
80
|
+
RSpec::Core::RakeTask.new(:foot) do |t|
|
81
|
+
t.pattern = 'spec/foot_spec.rb'
|
82
|
+
end
|
83
|
+
|
84
|
+
RSpec::Core::RakeTask.new(:head) do |t|
|
85
|
+
t.pattern = 'spec/head_spec.rb'
|
86
|
+
end
|
87
|
+
|
88
|
+
RSpec::Core::RakeTask.new(:header) do |t|
|
89
|
+
t.pattern = 'spec/header_spec.rb'
|
90
|
+
end
|
91
|
+
|
92
|
+
RSpec::Core::RakeTask.new(:html_handler) do |t|
|
93
|
+
t.pattern = 'spec/html_handler_spec.rb'
|
94
|
+
end
|
95
|
+
|
96
|
+
RSpec::Core::RakeTask.new(:row) do |t|
|
97
|
+
t.pattern = 'spec/row_spec.rb'
|
98
|
+
end
|
99
|
+
|
100
|
+
RSpec::Core::RakeTask.new(:table) do |t|
|
101
|
+
t.pattern = 'spec/table_spec.rb'
|
102
|
+
end
|
103
|
+
|
104
|
+
RSpec::Core::RakeTask.new(:tablesection) do |t|
|
105
|
+
t.pattern = 'spec/tablesection_spec.rb'
|
106
|
+
end
|
107
|
+
|
108
|
+
RSpec::Core::RakeTask.new(:tag_handler) do |t|
|
109
|
+
t.pattern = 'spec/tag_handler_spec.rb'
|
110
|
+
end
|
111
|
+
|
112
|
+
RSpec::Core::RakeTask.new(:all) do |t|
|
113
|
+
t.pattern = 'spec/*_spec.rb'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
task :default => ['spec:all', :clean]
|
data/html-table.gemspec
CHANGED
@@ -2,21 +2,21 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'html-table'
|
5
|
-
spec.version = '1.
|
5
|
+
spec.version = '1.7.0'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.license = 'Apache-2.0'
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
9
9
|
spec.homepage = 'http://github.com/djberg96/html-table'
|
10
10
|
spec.summary = 'A Ruby interface for generating HTML tables'
|
11
|
-
spec.test_files = Dir['
|
11
|
+
spec.test_files = Dir['spec/*.rb']
|
12
12
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
13
|
spec.cert_chain = ['certs/djberg96_pub.pem']
|
14
14
|
|
15
15
|
spec.extra_rdoc_files = ['README.rdoc', 'CHANGES.rdoc'] + Dir['doc/*.rdoc']
|
16
16
|
|
17
|
-
spec.add_dependency('structured_warnings', '~> 0.
|
17
|
+
spec.add_dependency('structured_warnings', '~> 0.4.0')
|
18
18
|
|
19
|
-
spec.add_development_dependency('
|
19
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
20
20
|
spec.add_development_dependency('rake')
|
21
21
|
|
22
22
|
spec.metadata = {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# with HTML tables. In some cases validation is done on the setters.
|
3
3
|
#--
|
4
4
|
# The seemingly redundant writer methods were left here for backwards
|
5
|
-
# compatibility and for those who may not prefer the
|
5
|
+
# compatibility and for those who may not prefer the DSL.
|
6
6
|
#
|
7
7
|
module HTML
|
8
8
|
module Mixin
|
@@ -394,7 +394,7 @@ module HTML
|
|
394
394
|
end
|
395
395
|
|
396
396
|
def width=(num)
|
397
|
-
if num =~ /%/
|
397
|
+
if num.to_s =~ /%/
|
398
398
|
@width = num
|
399
399
|
else
|
400
400
|
raise ArgumentError if num.to_i < 0
|
data/lib/html/table.rb
CHANGED
@@ -0,0 +1,360 @@
|
|
1
|
+
############################################################################
|
2
|
+
# attribute_handler_spec.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 'rspec'
|
8
|
+
require 'html/table'
|
9
|
+
|
10
|
+
RSpec.describe HTML::Mixin::AttributeHandler do
|
11
|
+
before(:all) do
|
12
|
+
NonStandardExtensionWarning.disable
|
13
|
+
end
|
14
|
+
|
15
|
+
before do
|
16
|
+
@table = HTML::Table.new(['foo',1,'bar'])
|
17
|
+
end
|
18
|
+
|
19
|
+
example "abbr_basic" do
|
20
|
+
expect(@table).to respond_to(:abbr)
|
21
|
+
expect(@table).to respond_to(:abbr=)
|
22
|
+
end
|
23
|
+
|
24
|
+
example "abbr" do
|
25
|
+
expect{ @table.abbr }.not_to raise_error
|
26
|
+
expect(@table.abbr).to be_nil
|
27
|
+
expect{ @table.abbr = 'foo' }.not_to raise_error
|
28
|
+
expect( @table.abbr).to eq('foo')
|
29
|
+
end
|
30
|
+
|
31
|
+
example "align_basic" do
|
32
|
+
expect(@table).to respond_to(:align)
|
33
|
+
expect(@table).to respond_to(:align=)
|
34
|
+
end
|
35
|
+
|
36
|
+
example "align" do
|
37
|
+
expect{ @table.align }.not_to raise_error
|
38
|
+
expect(@table.align).to be_nil
|
39
|
+
expect{ @table.align = 'center' }.not_to raise_error
|
40
|
+
expect( @table.align).to eq('center')
|
41
|
+
end
|
42
|
+
|
43
|
+
example "align_expected_errors" do
|
44
|
+
expect{ @table.align = 'foo' }.to raise_error(ArgumentError)
|
45
|
+
end
|
46
|
+
|
47
|
+
example "axis" do
|
48
|
+
expect(@table).to respond_to(:axis)
|
49
|
+
expect(@table).to respond_to(:axis=)
|
50
|
+
expect{ @table.axis }.not_to raise_error
|
51
|
+
expect{ @table.axis = 'foo' }.not_to raise_error
|
52
|
+
end
|
53
|
+
|
54
|
+
example "background_basic" do
|
55
|
+
expect(@table).to respond_to(:background)
|
56
|
+
expect(@table).to respond_to(:background=)
|
57
|
+
end
|
58
|
+
|
59
|
+
example "background" do
|
60
|
+
expect{ @table.background }.not_to raise_error
|
61
|
+
expect(@table.background).to be_nil
|
62
|
+
expect{ @table.background = 'foo' }.not_to raise_error
|
63
|
+
expect( @table.background).to eq('foo')
|
64
|
+
end
|
65
|
+
|
66
|
+
example "background_expected_errors" do
|
67
|
+
expect{ @table.background = 1 }.to raise_error(TypeError)
|
68
|
+
end
|
69
|
+
|
70
|
+
example "bgcolor_basic" do
|
71
|
+
expect(@table).to respond_to(:bgcolor)
|
72
|
+
expect(@table).to respond_to(:bgcolor=)
|
73
|
+
end
|
74
|
+
|
75
|
+
example "bgcolor" do
|
76
|
+
expect{ @table.bgcolor }.not_to raise_error
|
77
|
+
expect(@table.bgcolor).to be_nil
|
78
|
+
expect{ @table.bgcolor = 'foo' }.not_to raise_error
|
79
|
+
expect( @table.bgcolor).to eq('foo')
|
80
|
+
end
|
81
|
+
|
82
|
+
example "border_basic" do
|
83
|
+
expect(@table).to respond_to(:border)
|
84
|
+
expect(@table).to respond_to(:border=)
|
85
|
+
end
|
86
|
+
|
87
|
+
example "border" do
|
88
|
+
expect{ @table.border }.not_to raise_error
|
89
|
+
expect{ @table.border = 2 }.not_to raise_error
|
90
|
+
expect{ @table.border = true }.not_to raise_error
|
91
|
+
expect{ @table.border = false }.not_to raise_error
|
92
|
+
end
|
93
|
+
|
94
|
+
example "bordercolor_basic" do
|
95
|
+
expect(@table).to respond_to(:bordercolor)
|
96
|
+
expect(@table).to respond_to(:bordercolor=)
|
97
|
+
end
|
98
|
+
|
99
|
+
example "bordercolor" do
|
100
|
+
expect{ @table.bordercolor }.not_to raise_error
|
101
|
+
expect(@table.bordercolor).to be_nil
|
102
|
+
expect{ @table.bordercolor = 'foo' }.not_to raise_error
|
103
|
+
expect( @table.bordercolor).to eq('foo')
|
104
|
+
end
|
105
|
+
|
106
|
+
example "bordercolordark_basic" do
|
107
|
+
expect(@table).to respond_to(:bordercolordark)
|
108
|
+
expect(@table).to respond_to(:bordercolordark=)
|
109
|
+
end
|
110
|
+
|
111
|
+
example "bordercolordark" do
|
112
|
+
expect{ @table.bordercolordark }.not_to raise_error
|
113
|
+
expect(@table.bordercolordark).to be_nil
|
114
|
+
expect{ @table.bordercolordark = 'foo' }.not_to raise_error
|
115
|
+
expect( @table.bordercolordark).to eq('foo')
|
116
|
+
end
|
117
|
+
|
118
|
+
example "bordercolorlight" do
|
119
|
+
expect(@table).to respond_to(:bordercolorlight)
|
120
|
+
expect(@table).to respond_to(:bordercolorlight=)
|
121
|
+
expect{ @table.bordercolorlight }.not_to raise_error
|
122
|
+
expect{ @table.bordercolorlight = 'foo' }.not_to raise_error
|
123
|
+
end
|
124
|
+
|
125
|
+
example "cellpadding" do
|
126
|
+
expect(@table).to respond_to(:cellpadding)
|
127
|
+
expect(@table).to respond_to(:cellpadding=)
|
128
|
+
expect{ @table.cellpadding }.not_to raise_error
|
129
|
+
expect{ @table.cellpadding = 1 }.not_to raise_error
|
130
|
+
end
|
131
|
+
|
132
|
+
example "cellpadding_expected_errors" do
|
133
|
+
expect{ @table.cellpadding = -1 }.to raise_error(ArgumentError)
|
134
|
+
end
|
135
|
+
|
136
|
+
example "cellspacing" do
|
137
|
+
expect(@table).to respond_to(:cellspacing)
|
138
|
+
expect(@table).to respond_to(:cellspacing=)
|
139
|
+
expect{ @table.cellspacing }.not_to raise_error
|
140
|
+
expect{ @table.cellspacing = 1 }.not_to raise_error
|
141
|
+
end
|
142
|
+
|
143
|
+
example "cellspacing_expected_errors" do
|
144
|
+
expect{ @table.cellspacing = -1 }.to raise_error(ArgumentError)
|
145
|
+
end
|
146
|
+
|
147
|
+
example "char" do
|
148
|
+
expect(@table).to respond_to(:char)
|
149
|
+
expect(@table).to respond_to(:char=)
|
150
|
+
expect{ @table.char }.not_to raise_error
|
151
|
+
expect{ @table.char = 'x' }.not_to raise_error
|
152
|
+
end
|
153
|
+
|
154
|
+
example "char_expected_errors" do
|
155
|
+
expect{ @table.char = 'xx' }.to raise_error(ArgumentError)
|
156
|
+
end
|
157
|
+
|
158
|
+
example "charoff" do
|
159
|
+
expect(@table).to respond_to(:charoff)
|
160
|
+
expect(@table).to respond_to(:charoff=)
|
161
|
+
expect{ @table.charoff }.not_to raise_error
|
162
|
+
expect{ @table.charoff = 1 }.not_to raise_error
|
163
|
+
end
|
164
|
+
|
165
|
+
example "charoff_expected_errors" do
|
166
|
+
expect{ @table.charoff = -1 }.to raise_error(ArgumentError)
|
167
|
+
end
|
168
|
+
|
169
|
+
example "class" do
|
170
|
+
expect(@table).to respond_to(:class_)
|
171
|
+
expect(@table).to respond_to(:class_=)
|
172
|
+
expect{ @table.class_ }.not_to raise_error
|
173
|
+
expect{ @table.class_ = 'myclass' }.not_to raise_error
|
174
|
+
end
|
175
|
+
|
176
|
+
example "col" do
|
177
|
+
expect(@table).to respond_to(:col)
|
178
|
+
expect(@table).to respond_to(:col=)
|
179
|
+
expect{ @table.col }.not_to raise_error
|
180
|
+
expect{ @table.col = 1 }.not_to raise_error
|
181
|
+
end
|
182
|
+
|
183
|
+
example "col_expected_errors" do
|
184
|
+
expect{ @table.col = -1 }.to raise_error(ArgumentError)
|
185
|
+
end
|
186
|
+
|
187
|
+
example "colspan" do
|
188
|
+
expect(@table).to respond_to(:colspan)
|
189
|
+
expect(@table).to respond_to(:colspan=)
|
190
|
+
expect{ @table.colspan }.not_to raise_error
|
191
|
+
expect{ @table.colspan = 1 }.not_to raise_error
|
192
|
+
end
|
193
|
+
|
194
|
+
example "colspan_expected_errors" do
|
195
|
+
expect{ @table.colspan = -1 }.to raise_error(ArgumentError)
|
196
|
+
end
|
197
|
+
|
198
|
+
example "configure" do
|
199
|
+
expect(@table).to respond_to(:configure)
|
200
|
+
expect{ @table.configure(0){}.not_to raise_error }
|
201
|
+
expect{ @table.configure(0,0){}.not_to raise_error }
|
202
|
+
end
|
203
|
+
|
204
|
+
example "configure_expected_errors" do
|
205
|
+
expect{ @table.configure(0,0,0){}.to raise_error(ArgumentError) }
|
206
|
+
end
|
207
|
+
|
208
|
+
########################################################################
|
209
|
+
# This test could probably be broken out into separate tests for each
|
210
|
+
# type that we want to add as content.
|
211
|
+
########################################################################
|
212
|
+
example "content" do
|
213
|
+
expect(@table).to respond_to(:content)
|
214
|
+
expect(@table).to respond_to(:content=)
|
215
|
+
expect{ @table.content = 'foo' }.not_to raise_error
|
216
|
+
expect{ @table.content = 123 }.not_to raise_error
|
217
|
+
expect{ @table.content = ['one',2,'three'] }.not_to raise_error
|
218
|
+
expect{ @table.content = [['foo','bar'],[1,2,3]] }.not_to raise_error
|
219
|
+
expect{ @table.content = HTML::Table::Row.new }.not_to raise_error
|
220
|
+
expect{ @table.content = HTML::Table::Row::Data.new }.not_to raise_error
|
221
|
+
expect{ @table.content = HTML::Table::Row::Header.new }.not_to raise_error
|
222
|
+
expect{ @table.content = HTML::Table::Head.create }.not_to raise_error
|
223
|
+
expect{ @table.content = HTML::Table::Foot.create }.not_to raise_error
|
224
|
+
expect{ @table.content = HTML::Table::Body.new }.not_to raise_error
|
225
|
+
end
|
226
|
+
|
227
|
+
example "frame" do
|
228
|
+
expect(@table).to respond_to(:frame)
|
229
|
+
expect(@table).to respond_to(:frame=)
|
230
|
+
expect{ @table.frame }.not_to raise_error
|
231
|
+
expect{ @table.frame = 'below' }.not_to raise_error
|
232
|
+
end
|
233
|
+
|
234
|
+
example "frame_expected_errors" do
|
235
|
+
expect{ @table.frame = 'foo' }.to raise_error(ArgumentError)
|
236
|
+
end
|
237
|
+
|
238
|
+
example "height" do
|
239
|
+
expect(@table).to respond_to(:height)
|
240
|
+
expect(@table).to respond_to(:height=)
|
241
|
+
expect{ @table.height }.not_to raise_error
|
242
|
+
expect{ @table.height = 1 }.not_to raise_error
|
243
|
+
end
|
244
|
+
|
245
|
+
example "height_expected_errors" do
|
246
|
+
expect{ @table.height = -1 }.to raise_error(ArgumentError)
|
247
|
+
end
|
248
|
+
|
249
|
+
example "hspace" do
|
250
|
+
expect(@table).to respond_to(:hspace)
|
251
|
+
expect(@table).to respond_to(:hspace=)
|
252
|
+
expect{ @table.hspace }.not_to raise_error
|
253
|
+
expect{ @table.hspace = 1 }.not_to raise_error
|
254
|
+
end
|
255
|
+
|
256
|
+
example "hspace_expected_errors" do
|
257
|
+
expect{ @table.hspace = -1 }.to raise_error(ArgumentError)
|
258
|
+
end
|
259
|
+
|
260
|
+
example "nowrap" do
|
261
|
+
expect(@table).to respond_to(:nowrap)
|
262
|
+
expect(@table).to respond_to(:nowrap=)
|
263
|
+
expect{ @table.nowrap }.not_to raise_error
|
264
|
+
expect{ @table.nowrap = false }.not_to raise_error
|
265
|
+
end
|
266
|
+
|
267
|
+
example "nowrap_expected_errors" do
|
268
|
+
expect{ @table.nowrap = 'foo' }.to raise_error(TypeError)
|
269
|
+
end
|
270
|
+
|
271
|
+
example "rowspan" do
|
272
|
+
expect(@table).to respond_to(:rowspan)
|
273
|
+
expect(@table).to respond_to(:rowspan=)
|
274
|
+
expect{ @table.rowspan }.not_to raise_error
|
275
|
+
expect{ @table.rowspan = 1 }.not_to raise_error
|
276
|
+
end
|
277
|
+
|
278
|
+
example "rowspan_expected_errors" do
|
279
|
+
expect{ @table.rowspan = -1 }.to raise_error(ArgumentError)
|
280
|
+
end
|
281
|
+
|
282
|
+
example "rules" do
|
283
|
+
expect(@table).to respond_to(:rules)
|
284
|
+
expect(@table).to respond_to(:rules=)
|
285
|
+
expect{ @table.rules }.not_to raise_error
|
286
|
+
expect{ @table.rules = 'all' }.not_to raise_error
|
287
|
+
end
|
288
|
+
|
289
|
+
example "rules_expected_errors" do
|
290
|
+
expect{ @table.rules = 'foo' }.to raise_error(ArgumentError)
|
291
|
+
end
|
292
|
+
|
293
|
+
example "span" do
|
294
|
+
expect(@table).to respond_to(:span)
|
295
|
+
expect(@table).to respond_to(:span=)
|
296
|
+
expect{ @table.span }.not_to raise_error
|
297
|
+
expect{ @table.span = 1 }.not_to raise_error
|
298
|
+
end
|
299
|
+
|
300
|
+
example "span_expected_errors" do
|
301
|
+
expect{ @table.span = -1 }.to raise_error(ArgumentError)
|
302
|
+
end
|
303
|
+
|
304
|
+
example "style" do
|
305
|
+
expect(@table).to respond_to(:style)
|
306
|
+
expect(@table).to respond_to(:style=)
|
307
|
+
expect{ @table.style }.not_to raise_error
|
308
|
+
expect{ @table.style = 'color: blue' }.not_to raise_error
|
309
|
+
end
|
310
|
+
|
311
|
+
example "summary" do
|
312
|
+
expect(@table).to respond_to(:summary)
|
313
|
+
expect(@table).to respond_to(:summary=)
|
314
|
+
expect{ @table.summary }.not_to raise_error
|
315
|
+
expect{ @table.summary = 'foo' }.not_to raise_error
|
316
|
+
expect{ @table.summary = 1 }.not_to raise_error
|
317
|
+
end
|
318
|
+
|
319
|
+
example "valign" do
|
320
|
+
expect(@table).to respond_to(:valign)
|
321
|
+
expect(@table).to respond_to(:valign=)
|
322
|
+
expect{ @table.valign }.not_to raise_error
|
323
|
+
expect{ @table.valign = 'center' }.not_to raise_error
|
324
|
+
end
|
325
|
+
|
326
|
+
example "valign_expected_errors" do
|
327
|
+
expect{ @table.valign = 'foo' }.to raise_error(ArgumentError)
|
328
|
+
end
|
329
|
+
|
330
|
+
example "vspace" do
|
331
|
+
expect(@table).to respond_to(:vspace)
|
332
|
+
expect(@table).to respond_to(:vspace=)
|
333
|
+
expect{ @table.vspace }.not_to raise_error
|
334
|
+
expect{ @table.vspace = 1 }.not_to raise_error
|
335
|
+
end
|
336
|
+
|
337
|
+
example "vspace_expected_errors" do
|
338
|
+
expect{ @table.vspace = -1 }.to raise_error(ArgumentError)
|
339
|
+
end
|
340
|
+
|
341
|
+
example "width" do
|
342
|
+
expect(@table).to respond_to(:width)
|
343
|
+
expect(@table).to respond_to(:width=)
|
344
|
+
expect{ @table.width}.not_to raise_error
|
345
|
+
expect{ @table.width = 10 }.not_to raise_error
|
346
|
+
end
|
347
|
+
|
348
|
+
example "width_with_percent" do
|
349
|
+
expect{ @table.width = '5%' }.not_to raise_error
|
350
|
+
expect( @table.width).to eq('5%')
|
351
|
+
end
|
352
|
+
|
353
|
+
example "width_expected_errors" do
|
354
|
+
expect{ @table.width = -1 }.to raise_error(ArgumentError)
|
355
|
+
end
|
356
|
+
|
357
|
+
after(:all) do
|
358
|
+
NonStandardExtensionWarning.enable
|
359
|
+
end
|
360
|
+
end
|