Sha256: c20271d7c113ec9aa78bc5800094d677862ac8179d3a7132a0827764b5f9a7b8

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

@completed
Feature: Validation: validates_acceptance_of
  The validates_acceptance_of validation specifies that a virtual
  attribute must be set to "1" (i.e. from a HTML checkbox)
  
  Scenario: validation requirements met
    Given the following document definition:
      """
      class User < Recliner::Document
        validates_acceptance_of :terms_and_conditions
      end
      """
      
    When I create an instance of "User"
    And I set its terms_and_conditions to "1"
    Then the instance should be valid
  
  Scenario: validation requirements met (nil allowed)
    Given the following document definition:
      """
      class User < Recliner::Document
        validates_acceptance_of :terms_and_conditions, :allow_nil => true
      end
      """
      
    When I create an instance of "User"
    Then the instance should be valid
  
  Scenario: validation requirements failing
    Given the following document definition:
      """
      
      class User < Recliner::Document
        validates_acceptance_of :terms_and_conditions
      end
      """
    When I create an instance of "User"
    And I set its terms_and_conditions to "0"
    Then the instance should not be valid
    And its errors should include "Terms and conditions must be accepted"
    

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
recliner-0.0.1 features/validation/acceptance.feature