aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorElise Huard <git@elisehuard.be>2009-08-09 10:24:28 +0200
committerJeremy Kemper <jeremy@bitsweat.net>2009-08-09 12:50:04 -0700
commitc5896bfd8432f6b7a1c6cb06486c5c85eafe9450 (patch)
tree476a0865dd27515f944631266d448400fc30833a /activerecord/test
parent87e2c1895f486937cfb5ea2a3a4168b3a57d447b (diff)
downloadrails-c5896bfd8432f6b7a1c6cb06486c5c85eafe9450.tar.gz
rails-c5896bfd8432f6b7a1c6cb06486c5c85eafe9450.tar.bz2
rails-c5896bfd8432f6b7a1c6cb06486c5c85eafe9450.zip
validate uniqueness with limit in utf8
[#2653 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/validations/uniqueness_validation_test.rb10
1 files changed, 10 insertions, 0 deletions
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"