Sha256: aeb9dcc865afb1121f9661b1919c03de1dd8098a0f7bcc88e32a779d80a8079d

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

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

require 'test/unit'
require 'nitro/builders/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

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.16.0 test/nitro/builders/tc_table.rb
nitro-0.17.0 test/nitro/builders/tc_table.rb