From 017f5d5308098438da0b8c44163af4ecb422f1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 9 Jan 2010 00:17:16 +0100 Subject: Fix typo by renaming :genre to :gender. --- activemodel/lib/active_model/validations/validates.rb | 2 +- activemodel/test/cases/validations/validates_test.rb | 12 ++++++------ activemodel/test/models/person.rb | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'activemodel') diff --git a/activemodel/lib/active_model/validations/validates.rb b/activemodel/lib/active_model/validations/validates.rb index ea7303c70b..80924f50d6 100644 --- a/activemodel/lib/active_model/validations/validates.rb +++ b/activemodel/lib/active_model/validations/validates.rb @@ -54,7 +54,7 @@ module ActiveModel # The validators hash can also handle regular expressions, ranges and arrays: # # validates :email, :format => /@/ - # validates :genre, :inclusion => %w(mail female) + # validates :gender, :inclusion => %w(mail female) # validates :password, :length => 6..20 # # Finally, the options :if, :unless, :on, :allow_blank and :allow_nil can be given diff --git a/activemodel/test/cases/validations/validates_test.rb b/activemodel/test/cases/validations/validates_test.rb index 966690d75f..d15fb4a524 100644 --- a/activemodel/test/cases/validations/validates_test.rb +++ b/activemodel/test/cases/validations/validates_test.rb @@ -70,20 +70,20 @@ class ValidatesTest < ActiveModel::TestCase end def test_validates_with_array - Person.validates :genre, :inclusion => %w(m f) + Person.validates :gender, :inclusion => %w(m f) person = Person.new assert person.invalid? - assert_equal ['is not included in the list'], person.errors[:genre] - person.genre = "m" + assert_equal ['is not included in the list'], person.errors[:gender] + person.gender = "m" assert person.valid? end def test_validates_with_range - Person.validates :password, :length => 6..20 + Person.validates :karma, :length => 6..20 person = Person.new assert person.invalid? - assert_equal ['is too short (minimum is 6 characters)'], person.errors[:password] - person.password = '123456' + assert_equal ['is too short (minimum is 6 characters)'], person.errors[:karma] + person.karma = 'something' assert person.valid? end diff --git a/activemodel/test/models/person.rb b/activemodel/test/models/person.rb index 86e8d73bbb..cf16a38618 100644 --- a/activemodel/test/models/person.rb +++ b/activemodel/test/models/person.rb @@ -2,7 +2,7 @@ class Person include ActiveModel::Validations extend ActiveModel::Translation - attr_accessor :title, :karma, :salary, :genre, :password + attr_accessor :title, :karma, :salary, :gender def condition_is_true true -- cgit v1.2.3