oh you mean a check for uniqueness.

Is this rails? If it is, pretty sure you can do this:

item = Item.create(:abbreviation => "ab")
duplicate_item = Item.create(:abbreviation => "ab")
duplicate_item.new_record?.should_be true

or

item = Item.new(:abbreviation => "ab")
item.should_be valid
item.save
duplicate_item = Item.new(:abbreviation => "ab")
duplicate_item.should_not be_valid


On 18/04/2012, at 11:11 AM, Luciano Borges wrote:

> 2012/4/17 Julian Leviston <jul...@leviston.net>
> What do you mean repeated? You mean you can't have an abbreviation with two 
> of the same letters?
> 
> Julian
> 
> Hi Julian,
> 
> Yes. I cat't have the same abbreviation on the table, I know that I have to 
> put the validation in the model, but, I'd like to test first before change my 
> model.
> 
> Luciano 
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to