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
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
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
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
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
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