test/unit/footer_test.rb in table_helper-0.2.0 vs test/unit/footer_test.rb in table_helper-0.2.1
- old
+ new
@@ -42,12 +42,12 @@
end
end
class FooterWithCellsTest < Test::Unit::TestCase
def setup
- table = TableHelper::CollectionTable.new([Object.new])
- @footer = TableHelper::Footer.new(table)
+ @table = TableHelper::CollectionTable.new([Object.new])
+ @footer = TableHelper::Footer.new(@table)
@cell = @footer.cell :total, 20
end
def test_should_namespace_cell_classes
assert_equal 'object-total', @cell[:class]
@@ -56,9 +56,22 @@
def test_should_build_html
expected = <<-end_str
<tfoot>
<tr>
<td class="object-total">20</td>
+ </tr>
+ </tfoot>
+ end_str
+ assert_html_equal expected, @footer.html
+ end
+
+ def test_should_include_colspan_if_more_headers_than_footers
+ @table.header :title, :name, :value
+
+ expected = <<-end_str
+ <tfoot>
+ <tr>
+ <td class="object-total" colspan="3">20</td>
</tr>
</tfoot>
end_str
assert_html_equal expected, @footer.html
end