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/regional_office_spec.rb

41 lines
897 B
Ruby
Raw Normal View History

2018-12-06 17:49:50 -05:00
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe RegionalOffice do
subject { create :regional_office }
2019-07-20 06:07:02 -04:00
describe '#federal_subject' do
it { is_expected.to belong_to :federal_subject }
2018-12-06 17:49:50 -05:00
2019-07-20 06:07:02 -04:00
it do
is_expected.to \
validate_presence_of(:federal_subject)
.with_message(:required)
end
2019-07-20 06:07:02 -04:00
it { is_expected.to validate_uniqueness_of :federal_subject }
end
describe '#all_relationships' do
2019-07-20 06:07:02 -04:00
it do
is_expected.to \
have_many(:all_relationships)
.class_name('Relationship')
.inverse_of(:regional_office)
.dependent(:restrict_with_exception)
end
end
describe '#all_people' do
2019-07-20 06:07:02 -04:00
it do
is_expected.to \
have_many(:all_people)
.class_name('Person')
.inverse_of(:current_regional_office)
.through(:all_relationships)
2019-07-20 06:07:02 -04:00
.source(:person)
end
end
2018-12-06 17:49:50 -05:00
end