root/trunk/test/validation_test.rb

Revision 21, 0.8 kB (checked in by olivier, 4 years ago)

Load ./for-1.1/ into trunk.

Line 
1 require File.dirname(__FILE__) + '/test_helper'
2
3 class ValidationTest < Test::Unit::TestCase
4   include Globalize
5
6   fixtures :globalize_languages, :globalize_countries,
7     :globalize_translations, :globalize_products
8
9   class Product < ActiveRecord::Base
10     set_table_name "globalize_products"
11
12     validates_length_of :name, :minimum => 5
13     validates_length_of :specs, :maximum => 10
14   end
15
16   def setup
17     Globalize::Locale.set("he-IL")
18   end
19
20   def test_max_validation
21     prod = Product.find(2)
22     assert !prod.valid?
23     assert_equal "המ׀ךט א׹וך מדי (המקסימום הוא 10 תווים)", prod.errors.full_messages[1]
24
25     prod = Product.find(3)
26     assert !prod.valid?
27     assert_equal "Name is too short (minimum is 5 characters)", prod.errors.full_messages.first
28   end
29 end
Note: See TracBrowser for help on using the browser.