1 require File.dirname(__FILE__) + '/../test_helper'
3 class LayoutTest < Test::Unit::TestCase
5 test_helper :layouts, :validations
8 @layout = @model = Layout.new(VALID_LAYOUT_PARAMS)
11 def test_validates_presence_of
12 assert_valid :name, 'Just a Test'
13 assert_invalid :name, 'required', nil, '', ' '
16 def test_validates_uniqueness_of
17 assert_invalid :name, 'name already in use', 'Home Page'
18 assert_valid :name, 'Something Else'
21 def test_validates_length_of
24 }.each do |field, max|
25 assert_invalid field, ('%d-character limit' % max), 'x' * (max + 1)
26 assert_valid field, 'x' * max