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 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.abbreviation = nil
>       subject.should_not be_valid
>     end
>       
>     # I can do like example below or I have to break in parts?
> 
>     it "The abbreviation  should have 2 characters" do
>       subject.abbreviation = "BA"
>       subject.should be_valid
>       
>       subject.abbreviation = "B"
>       subject.should_not be_valid
>       
>       subject.abbreviation = "BAA"
>       subject.should_not be_valid
>     end
> 
>     it "The abbreviation can not be repeated" do
> 
>      # I don't know how to do!
> 
>     end
>   end
> end
> 
> Thanks,
> 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