Sha256: 27e6422a787a5ad35d69fd4192159dd100c66f06aa80080a83b2bff913007c9d
Contents?: true
Size: 1.91 KB
Versions: 1
Compression:
Stored size: 1.91 KB
Contents
@completed Feature: Validation: validates_inclusion_of The validates_inclusion_of validation specifies that an attribute must be one of a predefined set Scenario Outline: validation requirements met Given the following document definition: """ class User < Recliner::Document property :gender, String validates_inclusion_of :gender, :in => [ 'Male', 'Female' ] end """ When I create an instance of "User" And I set its gender to "<gender>" Then the instance should be valid Examples: | gender | | Male | | Female | Scenario Outline: validation requirements failing Given the following document definition: """ class User < Recliner::Document property :gender, String validates_inclusion_of :gender, :in => [ 'Male', 'Female' ] end """ When I create an instance of "User" And I set its gender to "<gender>" Then the instance should not be valid And its errors should include "Gender is not included in the list" Examples: | gender | | | | other | | male | | female | Scenario: validation requirements met (blank allowed) Given the following document definition: """ class User < Recliner::Document property :gender, String validates_inclusion_of :gender, :in => [ 'Male', 'Female' ], :allow_blank => true end """ When I create an instance of "User" And I set its gender to "" Then the instance should be valid Scenario: validation requirements met (nil allowed) Given the following document definition: """ class User < Recliner::Document property :gender, String validates_inclusion_of :gender, :in => [ 'Male', 'Female' ], :allow_nil => true end """ When I create an instance of "User" Then the instance should be valid
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
recliner-0.0.1 | features/validation/inclusion.feature |