table_helper 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +10 -0
- data/LICENSE +1 -1
- data/README.rdoc +78 -67
- data/Rakefile +1 -1
- data/lib/table_helper.rb +200 -169
- data/lib/table_helper/body.rb +46 -49
- data/lib/table_helper/body_row.rb +18 -14
- data/lib/table_helper/cell.rb +33 -22
- data/lib/table_helper/collection_table.rb +111 -37
- data/lib/table_helper/footer.rb +9 -7
- data/lib/table_helper/header.rb +31 -93
- data/lib/table_helper/html_element.rb +1 -3
- data/lib/table_helper/row.rb +16 -7
- data/test/helpers/table_helper_test.rb +20 -12
- data/test/unit/body_row_test.rb +66 -16
- data/test/unit/body_test.rb +159 -131
- data/test/unit/cell_test.rb +90 -16
- data/test/unit/collection_table_test.rb +166 -192
- data/test/unit/footer_test.rb +33 -8
- data/test/unit/header_test.rb +136 -114
- data/test/unit/row_builder_test.rb +16 -8
- data/test/unit/row_test.rb +106 -45
- metadata +3 -5
- data/test/unit/header_builder_test.rb +0 -48
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Pfeifer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-04-25 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -39,7 +39,6 @@ files:
|
|
39
39
|
- test/unit/body_row_test.rb
|
40
40
|
- test/unit/header_test.rb
|
41
41
|
- test/unit/collection_table_test.rb
|
42
|
-
- test/unit/header_builder_test.rb
|
43
42
|
- test/unit/body_test.rb
|
44
43
|
- test/unit/html_element_test.rb
|
45
44
|
- test/unit/footer_test.rb
|
@@ -73,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
72
|
requirements: []
|
74
73
|
|
75
74
|
rubyforge_project: pluginaweek
|
76
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.3.1
|
77
76
|
signing_key:
|
78
77
|
specification_version: 2
|
79
78
|
summary: Adds a helper method for generating HTML tables from collections
|
@@ -83,7 +82,6 @@ test_files:
|
|
83
82
|
- test/unit/body_row_test.rb
|
84
83
|
- test/unit/header_test.rb
|
85
84
|
- test/unit/collection_table_test.rb
|
86
|
-
- test/unit/header_builder_test.rb
|
87
85
|
- test/unit/body_test.rb
|
88
86
|
- test/unit/html_element_test.rb
|
89
87
|
- test/unit/footer_test.rb
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
-
|
3
|
-
class HeaderBuilderByDefaultTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
@header = TableHelper::Header.new([])
|
6
|
-
@builder = TableHelper::HeaderBuilder.new(@header)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_should_forward_missing_calls_to_row
|
10
|
-
assert_equal '<thead style="display: none;"><tr></tr></thead>', @builder.html
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class HeaderBuilderWithColumnsTest < Test::Unit::TestCase
|
15
|
-
def setup
|
16
|
-
@header = TableHelper::Header.new([])
|
17
|
-
@header.row.cell 'first-name'
|
18
|
-
|
19
|
-
@builder = TableHelper::HeaderBuilder.new(@header)
|
20
|
-
@builder.define_column('first-name')
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_should_create_column_reader
|
24
|
-
assert_nothing_raised {@builder.first_name}
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_should_read_column_without_arguments
|
28
|
-
assert_instance_of TableHelper::Cell, @builder.first_name
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_should_write_cell_with_arguments
|
32
|
-
@builder.first_name 'Your Name'
|
33
|
-
assert_equal '<td class="first-name">Your Name</td>', @header.row.cells['first-name'].html
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class RowBuilderAfterUndefiningAColumnTest < Test::Unit::TestCase
|
38
|
-
def setup
|
39
|
-
@header = TableHelper::Header.new([])
|
40
|
-
@builder = TableHelper::HeaderBuilder.new(@header)
|
41
|
-
@builder.define_column('first-name')
|
42
|
-
@builder.undef_column('first-name')
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_should_not_have_cell_reader
|
46
|
-
assert_raise(NoMethodError) {@builder.first_name}
|
47
|
-
end
|
48
|
-
end
|