From c5896bfd8432f6b7a1c6cb06486c5c85eafe9450 Mon Sep 17 00:00:00 2001 From: Elise Huard Date: Sun, 9 Aug 2009 10:24:28 +0200 Subject: validate uniqueness with limit in utf8 [#2653 state:committed] Signed-off-by: Jeremy Kemper --- .../test/cases/validations/uniqueness_validation_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/validations/uniqueness_validation_test.rb b/activerecord/test/cases/validations/uniqueness_validation_test.rb index e72013b59c..cb123d3498 100644 --- a/activerecord/test/cases/validations/uniqueness_validation_test.rb +++ b/activerecord/test/cases/validations/uniqueness_validation_test.rb @@ -238,6 +238,16 @@ class UniquenessValidationTest < ActiveRecord::TestCase assert !e2.valid?, "Created an event whose title, with limit taken into account, is not unique" end + def test_validate_uniqueness_with_limit_and_utf8 + with_kcode('UTF8') do + # Event.title is limited to 5 characters + e1 = Event.create(:title => "一二三四五") + assert e1.valid?, "Could not create an event with a unique, 5 character title" + e2 = Event.create(:title => "一二三四五六七八") + assert !e2.valid?, "Created an event whose title, with limit taken into account, is not unique" + end + end + def test_validate_straight_inheritance_uniqueness w1 = IneptWizard.create(:name => "Rincewind", :city => "Ankh-Morpork") assert w1.valid?, "Saving w1" -- cgit v1.2.3