Sha256: 1fa4c41f792d52e26f04ef774ca49e6d87e5ce7cd737b3bf331480070ecc64cd

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

require 'spec_helper'

describe Popolo::Membership do
  [:organization_id, :person_id].each do |attribute|
    it {should validate_presence_of attribute}
  end

  [:start_date, :end_date].each do |attribute|
    it {
      should validate_format_of(attribute).
        # 4.1.2.2 Basic format
        not_to_allow('20041231').
        # 4.1.2.2 Extended format
        to_allow('2004-12-31').
        # 4.1.2.3 a) A specific month
        to_allow('2004-01').
        # 4.1.2.3 b) A specific year
        to_allow('2004').
        # 4.1.2.3 c) A specific century
        not_to_allow('20').
        # Avoid confusion with YYMMDD
        not_to_allow('200401').
        # Date and time of day.
        not_to_allow('2004-12-31T00:00:00Z')
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
popolo-0.0.2 spec/models/popolo/membership_spec.rb
popolo-0.0.1 spec/models/popolo/membership_spec.rb