mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
clean up documentation in validate_uniqueness_of
This commit is contained in:
parent
85d19da45c
commit
bb99ed2599
1 changed files with 7 additions and 8 deletions
|
@ -2,15 +2,14 @@ module Shoulda # :nodoc:
|
|||
module Matchers
|
||||
module ActiveModel # :nodoc:
|
||||
# Ensures that the model is invalid if the given attribute is not unique.
|
||||
# It uses the first existing record or creates a new one if no record
|
||||
# exists in the database. It simply uses `:validate => false` to get
|
||||
# around validations, so it will probably fail if there are `NOT NULL`
|
||||
# constraints. In that case, you must create a record before calling
|
||||
# `validate_uniqueness_of`.
|
||||
#
|
||||
# Internally, this uses values from existing records to test validations,
|
||||
# so this will always fail if you have not saved at least one record for
|
||||
# the model being tested, like so:
|
||||
#
|
||||
# describe User do
|
||||
# before(:each) { User.create!(:email => 'address@example.com') }
|
||||
# Example:
|
||||
# it { should validate_uniqueness_of(:email) }
|
||||
# end
|
||||
#
|
||||
# Options:
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue