Skip to content

Commit

Permalink
Add documentation to validate_inclusion_of on qualifier
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
maurogeorge authored and mcmire committed Mar 29, 2015
1 parent d31046d commit 9a893f3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,33 @@ module ActiveModel
#
# #### 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.
Expand Down

0 comments on commit 9a893f3

Please sign in to comment.