[rspec-users] Testing Models without fixtures
dchelimsky at gmail.com
Tue Nov 20 09:40:06 EST 2007
On Nov 20, 2007 6:57 AM, Raimond Garcia <voodoorai2000 at gmail.com> wrote:
> 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.create!(:name => "John")
User.create!(:name => "George")
> Thanks in advance!
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users