1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/spec/models/passport_spec.rb

47 lines
1.3 KiB
Ruby
Raw Normal View History

2018-11-29 20:19:38 -05:00
# frozen_string_literal: true
require 'rails_helper'
2018-11-30 02:00:03 -05:00
RSpec.describe Passport do
2018-11-29 20:19:38 -05:00
subject { create :passport }
2018-11-30 03:28:40 -05:00
it do
is_expected.to \
have_many(:passport_confirmations)
.dependent(:restrict_with_exception)
end
2018-11-29 20:19:38 -05:00
it { is_expected.to validate_presence_of :surname }
it { is_expected.to validate_presence_of :given_name }
it { is_expected.not_to validate_presence_of :patronymic }
it { is_expected.to validate_presence_of :sex }
it { is_expected.to validate_presence_of :date_of_birth }
it { is_expected.to validate_presence_of :place_of_birth }
it { is_expected.to validate_presence_of :series }
it { is_expected.to validate_presence_of :number }
it { is_expected.to validate_presence_of :issued_by }
it { is_expected.to validate_presence_of :unit_code }
it { is_expected.to validate_presence_of :date_of_issue }
2018-12-01 05:23:58 -05:00
pending '#image'
2018-11-30 19:40:34 -05:00
pending '#enough_confirmations?'
2018-11-29 20:19:38 -05:00
describe '#patronymic' do
context 'when it is empty' do
subject { create :passport, patronymic: '' }
specify do
expect(subject.patronymic).to eq nil
end
end
context 'when it is blank' do
subject { create :passport, patronymic: ' ' }
specify do
expect(subject.patronymic).to eq nil
end
end
end
end