table_helper 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +19 -0
- data/MIT-LICENSE +20 -0
- data/README +161 -0
- data/Rakefile +80 -0
- data/init.rb +1 -0
- data/lib/table_helper/body.rb +119 -0
- data/lib/table_helper/body_row.rb +86 -0
- data/lib/table_helper/cell.rb +51 -0
- data/lib/table_helper/collection_table.rb +60 -0
- data/lib/table_helper/footer.rb +47 -0
- data/lib/table_helper/header.rb +125 -0
- data/lib/table_helper/html_element.rb +46 -0
- data/lib/table_helper/row.rb +72 -0
- data/lib/table_helper.rb +182 -0
- data/test/body_row_test.rb +105 -0
- data/test/body_test.rb +271 -0
- data/test/cell_test.rb +52 -0
- data/test/collection_table_test.rb +254 -0
- data/test/footer_test.rb +72 -0
- data/test/header_test.rb +210 -0
- data/test/html_element_test.rb +74 -0
- data/test/row_test.rb +115 -0
- data/test/table_helper_test.rb +37 -0
- data/test/test_helper.rb +14 -0
- metadata +85 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class TableHelperTest < Test::Unit::TestCase
|
4
|
+
include PluginAWeek::TableHelper
|
5
|
+
|
6
|
+
def test_should_build_collection_table
|
7
|
+
html = collection_table(['first', 'second', 'last']) do |header, body|
|
8
|
+
header.column :title
|
9
|
+
|
10
|
+
body.build do |row, post_title, index|
|
11
|
+
row.title post_title
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
expected = <<-end_eval
|
16
|
+
<table cellpadding="0" cellspacing="0">
|
17
|
+
<thead>
|
18
|
+
<tr>
|
19
|
+
<th class="title" scope="col">Title</th>
|
20
|
+
</tr>
|
21
|
+
</thead>
|
22
|
+
<tbody>
|
23
|
+
<tr class="row">
|
24
|
+
<td class="title">first</td>
|
25
|
+
</tr>
|
26
|
+
<tr class="row">
|
27
|
+
<td class="title">second</td>
|
28
|
+
</tr>
|
29
|
+
<tr class="row">
|
30
|
+
<td class="title">last</td>
|
31
|
+
</tr>
|
32
|
+
</tbody>
|
33
|
+
</table>
|
34
|
+
end_eval
|
35
|
+
assert_html_equal expected, html
|
36
|
+
end
|
37
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'action_controller'
|
4
|
+
require 'action_view'
|
5
|
+
|
6
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
7
|
+
require File.dirname(__FILE__) + '/../init'
|
8
|
+
|
9
|
+
class Test::Unit::TestCase #:nodoc:
|
10
|
+
private
|
11
|
+
def assert_html_equal(expected, actual)
|
12
|
+
assert_equal expected.strip.gsub(/\n\s*/, ''), actual
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: table_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aaron Pfeifer
|
8
|
+
autorequire: table_helper
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-06-01 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: aaron@pluginaweek.org
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- lib/table_helper.rb
|
26
|
+
- lib/table_helper
|
27
|
+
- lib/table_helper/collection_table.rb
|
28
|
+
- lib/table_helper/html_element.rb
|
29
|
+
- lib/table_helper/body.rb
|
30
|
+
- lib/table_helper/footer.rb
|
31
|
+
- lib/table_helper/header.rb
|
32
|
+
- lib/table_helper/row.rb
|
33
|
+
- lib/table_helper/cell.rb
|
34
|
+
- lib/table_helper/body_row.rb
|
35
|
+
- test/header_test.rb
|
36
|
+
- test/collection_table_test.rb
|
37
|
+
- test/test_helper.rb
|
38
|
+
- test/row_test.rb
|
39
|
+
- test/footer_test.rb
|
40
|
+
- test/body_row_test.rb
|
41
|
+
- test/cell_test.rb
|
42
|
+
- test/html_element_test.rb
|
43
|
+
- test/body_test.rb
|
44
|
+
- test/table_helper_test.rb
|
45
|
+
- CHANGELOG
|
46
|
+
- init.rb
|
47
|
+
- MIT-LICENSE
|
48
|
+
- Rakefile
|
49
|
+
- README
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: http://www.pluginaweek.org
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.1.1
|
73
|
+
signing_key:
|
74
|
+
specification_version: 2
|
75
|
+
summary: Adds a helper method for generating HTML tables from collections
|
76
|
+
test_files:
|
77
|
+
- test/header_test.rb
|
78
|
+
- test/collection_table_test.rb
|
79
|
+
- test/row_test.rb
|
80
|
+
- test/footer_test.rb
|
81
|
+
- test/body_row_test.rb
|
82
|
+
- test/cell_test.rb
|
83
|
+
- test/html_element_test.rb
|
84
|
+
- test/body_test.rb
|
85
|
+
- test/table_helper_test.rb
|