[rspec-users] How to write a test for validates_uniqueness_of
tek.katu at gmail.com
Tue May 20 19:59:18 EDT 2008
I have a spec
it "should have a unique username "
I have a code:
Now, I don't know how to test this code. In order to test this, do I
need to run `save`?
@user = User.create(:username => "mike")
@another = User.create(:username => "mike")
This messes up test database. Is there any better way?
More information about the rspec-users