Wow,

Thanks Dave, that worked :)
I had tried before deleting all users and creating a couple of new  
ones, was wondering why it didn't work.
The problem was that I was using the create method instead of create!,  
thus, my users where silently being validated and not saved, as I was  
missing the password parameters and the such.

Thanks again!
Keep up the great work with rSpec!

Rai

On Nov 20, 2007, at 3:40 PM, David Chelimsky wrote:

> On Nov 20, 2007 6:57 AM, Raimond Garcia <[EMAIL PROTECTED]>  
> wrote:
>> Hi,
>>
>> I would like to test a sorting method that is in the user model, it's
>> a class method called search.
>> What I would like to do is create 2 users and load the test database
>> with just those 2 users, so that I can call
>> User.search("john") and it would return those two users.
>>
>> Not sure how to clear the test database and populate it just with
>> these 2 users for that specific spec.
>
> User.delete_all
> User.create!(:name => "John")
> User.create!(:name => "George")
>
>>
>> Thanks in advance!
>>
>> Rai
>> _______________________________________________
>> rspec-users mailing list
>> [email protected]
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to