[eXPlainPMT Developers] [SVN commit] r108 - in /trunk: app/models/user.rb db/schema.rb test/unit/user_test.rb
mannl@gmx.com
mannl at gmx.com
Tue Dec 20 13:03:14 EST 2005
Author: rmannl
Date: Tue Dec 20 13:03:04 2005
New Revision: 108
Log:
Removed minimum length for User#username and User#password
Modified:
trunk/app/models/user.rb
trunk/db/schema.rb
trunk/test/unit/user_test.rb
Modified: trunk/app/models/user.rb
==============================================================================
--- trunk/app/models/user.rb (original)
+++ trunk/app/models/user.rb Tue Dec 20 13:03:04 2005
@@ -25,10 +25,8 @@
# has_many :stories
#
# And the following data validations:
-# validates_presence_of :first_name, :last_name, :email
+# validates_presence_of :first_name, :last_name, :email, :username, :password
# validates_uniqueness_of :username, :email
-# validates_length_of :username, :minimum => 4
-# validates_length_of :password, :minimum => 6
# validates_confirmation_of :password
# validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/
#
@@ -36,10 +34,8 @@
has_and_belongs_to_many :projects
has_many :stories
- validates_presence_of :first_name, :last_name, :email
+ validates_presence_of :first_name, :last_name, :email, :username, :password
validates_uniqueness_of :username, :email
- validates_length_of :username, :minimum => 4
- validates_length_of :password, :minimum => 6
validates_confirmation_of :password
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/
Modified: trunk/db/schema.rb
==============================================================================
--- trunk/db/schema.rb (original)
+++ trunk/db/schema.rb Tue Dec 20 13:03:04 2005
@@ -1,61 +1,61 @@
-# This file is autogenerated. Instead of editing this file, please use the
-# migrations feature of ActiveRecord to incrementally modify your database, and
-# then regenerate this schema definition.
-
-ActiveRecord::Schema.define(:version => 1) do
-
- create_table "iterations", :force => true do |t|
- t.column "project_id", :integer, :default => 0, :null => false
- t.column "start_date", :date
- t.column "length", :integer, :default => 14
- t.column "budget", :integer
- t.column "created_at", :datetime
- t.column "updated_at", :datetime
- end
-
- create_table "milestones", :force => true do |t|
- t.column "project_id", :integer, :default => 0, :null => false
- t.column "date", :date
- t.column "name", :string
- t.column "description", :text
- t.column "created_at", :datetime
- t.column "updated_at", :datetime
- end
-
- create_table "projects", :force => true do |t|
- t.column "name", :string
- t.column "description", :text
- t.column "created_at", :datetime
- t.column "updated_at", :datetime
- end
-
- create_table "projects_users", :id => false, :force => true do |t|
- t.column "user_id", :integer, :default => 0, :null => false
- t.column "project_id", :integer, :default => 0, :null => false
- end
-
- create_table "stories", :force => true do |t|
- t.column "scid", :integer, :default => 0, :null => false
- t.column "project_id", :integer, :default => 0, :null => false
- t.column "iteration_id", :integer
- t.column "user_id", :integer
- t.column "title", :string
- t.column "points", :integer
- t.column "status", :integer
- t.column "priority", :integer
- t.column "risk", :integer
- t.column "description", :text
- end
-
- create_table "users", :force => true do |t|
- t.column "username", :string
- t.column "password", :string
- t.column "email", :string
- t.column "first_name", :string
- t.column "last_name", :string
- t.column "admin", :boolean, :default => false
- t.column "created_at", :datetime
- t.column "updated_at", :datetime
- end
-
-end
+# This file is autogenerated. Instead of editing this file, please use the
+# migrations feature of ActiveRecord to incrementally modify your database, and
+# then regenerate this schema definition.
+
+ActiveRecord::Schema.define(:version => 1) do
+
+ create_table "iterations", :force => true do |t|
+ t.column "project_id", :integer, :default => 0, :null => false
+ t.column "start_date", :date
+ t.column "length", :integer, :default => 14
+ t.column "budget", :integer
+ t.column "created_at", :datetime
+ t.column "updated_at", :datetime
+ end
+
+ create_table "milestones", :force => true do |t|
+ t.column "project_id", :integer, :default => 0, :null => false
+ t.column "date", :date
+ t.column "name", :string
+ t.column "description", :text
+ t.column "created_at", :datetime
+ t.column "updated_at", :datetime
+ end
+
+ create_table "projects", :force => true do |t|
+ t.column "name", :string
+ t.column "description", :text
+ t.column "created_at", :datetime
+ t.column "updated_at", :datetime
+ end
+
+ create_table "projects_users", :id => false, :force => true do |t|
+ t.column "user_id", :integer, :default => 0, :null => false
+ t.column "project_id", :integer, :default => 0, :null => false
+ end
+
+ create_table "stories", :force => true do |t|
+ t.column "scid", :integer, :default => 0, :null => false
+ t.column "project_id", :integer, :default => 0, :null => false
+ t.column "iteration_id", :integer
+ t.column "user_id", :integer
+ t.column "title", :string
+ t.column "points", :integer
+ t.column "status", :integer
+ t.column "priority", :integer
+ t.column "risk", :integer
+ t.column "description", :text
+ end
+
+ create_table "users", :force => true do |t|
+ t.column "username", :string
+ t.column "password", :string
+ t.column "email", :string
+ t.column "first_name", :string
+ t.column "last_name", :string
+ t.column "admin", :boolean, :default => false
+ t.column "created_at", :datetime
+ t.column "updated_at", :datetime
+ end
+
+end
Modified: trunk/test/unit/user_test.rb
==============================================================================
--- trunk/test/unit/user_test.rb (original)
+++ trunk/test/unit/user_test.rb Tue Dec 20 13:03:04 2005
@@ -32,6 +32,18 @@
assert_nil User.authenticate('bad_username', 'bad_password')
assert_nil User.authenticate(nil, nil)
end
+
+ def test_username_validations
+ @user_one.username = '_' * 1
+ @user_one.valid?
+ assert_nil @user_one.errors[:username]
+ end
+
+ def test_password_validations
+ @user_one.password = '_' * 1
+ @user_one.valid?
+ assert_nil @user_one.errors[:password]
+ end
end
More information about the Explainpmt-developers
mailing list