mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
Add documentation to validate_inclusion_of on qualifier
[ci skip]
This commit is contained in:
parent
d31046d90c
commit
9a893f372d
1 changed files with 27 additions and 0 deletions
|
@ -67,6 +67,33 @@ module Shoulda
|
|||
#
|
||||
# #### Qualifiers
|
||||
#
|
||||
# Use `on` if your validation applies only under a certain context.
|
||||
#
|
||||
# class Issue
|
||||
# include ActiveModel::Model
|
||||
# attr_accessor :severity
|
||||
#
|
||||
# validates_inclusion_of :severity,
|
||||
# in: %w(low medium high),
|
||||
# on: :create
|
||||
# end
|
||||
#
|
||||
# # RSpec
|
||||
# describe Issue do
|
||||
# it do
|
||||
# should validate_inclusion_of(:severity).
|
||||
# in_array(%w(low medium high)).
|
||||
# on(:create)
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# class IssueTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:severity).
|
||||
# in_array(%w(low medium high)).
|
||||
# on(:create)
|
||||
# end
|
||||
#
|
||||
# ##### with_message
|
||||
#
|
||||
# Use `with_message` if you are using a custom validation message.
|
||||
|
|
Loading…
Reference in a new issue