[rspec-users] [Newbie's Doubt] Model's Tests
Luciano Borges
lucianosantosborges at gmail.com
Wed Apr 18 00:50:57 UTC 2012
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120417/10b48e83/attachment.html>
More information about the rspec-users
mailing list