This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
2019-04-27 14:24:04 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Relationship do
|
|
|
|
subject { create :supporter_relationship }
|
|
|
|
|
|
|
|
it { is_expected.to belong_to(:person).required }
|
2019-04-28 12:48:51 +00:00
|
|
|
it { is_expected.to belong_to(:regional_office).required }
|
|
|
|
|
2019-04-28 13:24:01 +00:00
|
|
|
describe '#number' do
|
|
|
|
it { is_expected.to validate_presence_of :number }
|
|
|
|
|
|
|
|
it { is_expected.to validate_uniqueness_of(:number).scoped_to(:person_id) }
|
|
|
|
|
|
|
|
it do
|
|
|
|
is_expected.to \
|
|
|
|
validate_numericality_of(:number)
|
|
|
|
.only_integer
|
|
|
|
.is_greater_than_or_equal_to(0)
|
|
|
|
end
|
|
|
|
end
|
2019-06-05 01:37:55 +00:00
|
|
|
|
|
|
|
describe '#active_since' do
|
|
|
|
it { is_expected.to validate_presence_of :active_since }
|
|
|
|
end
|
2019-06-05 02:33:45 +00:00
|
|
|
|
|
|
|
describe '#status' do
|
|
|
|
it { is_expected.to validate_presence_of :status }
|
|
|
|
end
|
2019-04-27 14:24:04 +00:00
|
|
|
end
|