Hi,

I have a spec

 it "should have a unique username "

I have a code:

  validates_uniqueness_of :user_name


Now, I don't know how to test this code. In order to test this, do I
need to run `save`?

For example,

@user = User.create(:username => "mike")
@another = User.create(:username => "mike")
@another.save.should be_false

This messes up test database. Is there any better way?

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

Reply via email to