Sha256: 47a7c07b21b1e2221a20e7d90e28797e8ce1be686343e50dd37ff7a2bb3c8219

Contents?: true

Size: 929 Bytes

Versions: 3

Compression:

Stored size: 929 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

class TableHelperTest < Test::Unit::TestCase
  include PluginAWeek::TableHelper
  
  def test_should_build_collection_table
    html = collection_table(['first', 'second', 'last']) do |header, body|
      header.column :title
      
      body.build do |row, post_title, index|
        row.title post_title
      end
    end
    
    expected = <<-end_eval
      <table cellpadding="0" cellspacing="0">
        <thead>
          <tr>
            <th class="title" scope="col">Title</th>
          </tr>
        </thead>
        <tbody>
          <tr class="row">
            <td class="title">first</td>
          </tr>
          <tr class="row">
            <td class="title">second</td>
          </tr>
          <tr class="row">
            <td class="title">last</td>
          </tr>
        </tbody>
      </table>
    end_eval
    assert_html_equal expected, html
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
table_helper-0.0.5 test/table_helper_test.rb
table_helper-0.0.3 test/table_helper_test.rb
table_helper-0.0.4 test/table_helper_test.rb