Sha256: 09af9545682c905c5f007b6a00c8e3fc0d66935d73ea1e8b187b58d70d8e4b16

Contents?: true

Size: 1008 Bytes

Versions: 5

Compression:

Stored size: 1008 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')

require 'test/unit'
require 'nitro/mixin/table'

class TC_TableMixin < Test::Unit::TestCase # :nodoc: all
  include Nitro
  include TableMixin

  User = Struct.new(:name, :password, :email)

  def setup
    @headers = %w{Name Password Email}
    @users = [
      User.new('gmosx', 'huh?', 'gm@nowhere.com'),
      User.new('renos', 'nah', 'renos@nowhere.com'),
      User.new('stella', 'hoh', 'stella@love.com')
    ]
  end

  def teardown
    @users = nil
  end

  def test_table
    values = @users.collect { |u| [u.name, u.password, u.email] }
    table = build_table(:id => 'test', :headers => @headers, :values => values)
    res = %|<table id="test"><tr><th>Name</th><th>Password</th><th>Email</th></tr><tr><td>gmosx</td><td>huh?</td><td>gm@nowhere.com</td></tr><tr><td>renos</td><td>nah</td><td>renos@nowhere.com</td></tr><tr><td>stella</td><td>hoh</td><td>stella@love.com</td></tr></table>|
    assert_equal res, table
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nitro-0.21.0 test/nitro/mixin/tc_table.rb
nitro-0.21.2 test/nitro/mixin/tc_table.rb
nitro-0.22.0 test/nitro/mixin/tc_table.rb
nitro-0.23.0 test/nitro/mixin/tc_table.rb
nitro-0.24.0 test/nitro/mixin/tc_table.rb