Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Lenny Marks
On Apr 17, 2012, at 8:50 PM, Luciano Borges wrote: > I'm studying Rspec and doing some model's tests. > > I have a table with a field which must have two characters, the field should > not be empty and can not be repeated. > > My doubts is with #. > > describe State do > context "validatio

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Lenny Marks
Sorry! My posts are very delayed. On Apr 17, 2012, at 8:50 PM, Luciano Borges wrote: > I'm studying Rspec and doing some model's tests. > > I have a table with a field which must have two characters, the field should > not be empty and can not be repeated. > > My doubts is with #. > > descr

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Julian Leviston
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.s

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Luciano Borges
2012/4/17 Julian Leviston > 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

Re: [rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Julian Leviston
What do you mean repeated? You mean you can't have an abbreviation with two of the same letters? Julian On 18/04/2012, at 10:50 AM, Luciano Borges wrote: > I'm studying Rspec and doing some model's tests. > > I have a table with a field which must have two characters, the field should > not b

[rspec-users] [Newbie's Doubt] Model's Tests

2012-04-17 Thread Luciano Borges
I'm studying Rspec and doing some model's tests. I have a table with a field which must have two characters, the field should not be empty and can not be repeated. My doubts is with #. describe State do context "validations" do it "The abbreviation should not be empty" do subject.ab