Sha256: 54de627665df72e036828d3305268ccea7ace162510f6649985518f25c333244

Contents?: true

Size: 1011 Bytes

Versions: 4

Compression:

Stored size: 1011 Bytes

Contents

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

require 'test/unit'
require 'nitro/helper/table'

class TC_TableHelper < Test::Unit::TestCase # :nodoc: all
  include Nitro
  include TableHelper

  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

4 entries across 4 versions & 1 rubygems

Version Path
nitro-0.25.0 test/nitro/helper/tc_table.rb
nitro-0.26.0 test/nitro/helper/tc_table.rb
nitro-0.27.0 test/nitro/helper/tc_table.rb
nitro-0.28.0 test/nitro/helper/tc_table.rb