From 8b0c3725a583107e6bffd5cee4325aff7aa77a89 Mon Sep 17 00:00:00 2001 From: maxwell Date: Sat, 12 Jun 2010 15:55:29 -0700 Subject: [PATCH] push for rafi --- app/models/user.rb | 6 ++++++ spec/user_spec.rb | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 892d50953..541435042 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,4 +2,10 @@ class User include Mongoid::Document field :password + field :name + + + validates :password, :presence => true + validates :name, :presence =>true + end diff --git a/spec/user_spec.rb b/spec/user_spec.rb index b7b575682..9e0e37537 100644 --- a/spec/user_spec.rb +++ b/spec/user_spec.rb @@ -2,13 +2,17 @@ require 'spec_helper' describe 'a user should be able to log into his seed' do before do - User.all.each {|x| x.delete} + User.delete_all end it 'should should have a name and password' do User.count.should == 0 - billy = User.create - User.count.should == 1 + billy = User.new + User.count.should == 0 + billy.save + User.count.should == 0 + + end it 'should be able to log into a page with a password' do