Permalink
Browse files

make validates uniqueness of more clear

  • Loading branch information...
1 parent d85503f commit da55276874e29ebf783c5d96194aa95543a2fc03 @drapergeek drapergeek committed Apr 2, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 README.md
View
@@ -30,6 +30,12 @@ Matchers to test validations and mass assignments:
it { should validate_presence_of(:body).with_message(/wtf/) }
it { should validate_presence_of(:title) }
it { should validate_numericality_of(:user_id) }
+
+ #validates_uniqueness_of requires an entry to be in the database already
+ it "should validate uniqueness of title" do
+ Post.create!(title: "My Awesome Post")
+ subject.should validate_uniqueness_of(:title)
+ end
end
describe User do

0 comments on commit da55276

Please sign in to comment.