Sha256: d1dee15c9067fc3963c0edec9a8a385c577f3a8272eac50709a9b102cd209f70

Contents?: true

Size: 966 Bytes

Versions: 4

Compression:

Stored size: 966 Bytes

Contents

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

require 'test/unit'
require 'nitro/builder/table'

class TC_BuildersTable < Test::Unit::TestCase # :nodoc: all
	include Nitro

	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 = TableBuilder.build(: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.18.0 test/nitro/builder/tc_table.rb
nitro-0.18.1 test/nitro/builder/tc_table.rb
nitro-0.19.0 test/nitro/builder/tc_table.rb
nitro-0.20.0 test/nitro/builder/tc_table.rb