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/shared_examples/nameable.rb

29 lines
803 B
Ruby
Raw Normal View History

2019-03-26 18:06:03 -04:00
# frozen_string_literal: true
RSpec.shared_examples 'nameable' do
it { is_expected.to validate_presence_of :first_name }
it { is_expected.not_to validate_presence_of :middle_name }
it { is_expected.to validate_presence_of :last_name }
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 }
describe '#middle_name' do
context 'when it is empty' do
subject { create :member_person, middle_name: '' }
specify do
expect(subject.middle_name).to eq nil
end
end
context 'when it is blank' do
subject { create :member_person, middle_name: ' ' }
specify do
expect(subject.middle_name).to eq nil
end
end
end
end