1
0
Fork 0

Add method Relationship#excluded?

This commit is contained in:
Alex Kotov 2019-04-28 19:38:32 +05:00
parent 07c6d6c56c
commit d00efc38a0
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 38 additions and 0 deletions

View File

@ -47,6 +47,10 @@ class Relationship < ApplicationRecord
status == :member
end
def excluded?
status == :excluded
end
private
def membership_dates_are_not_in_future

View File

@ -199,4 +199,38 @@ RSpec.describe Relationship do
end
end
end
describe '#excluded?' do
context 'for supporter' do
subject { create :supporter_relationship }
specify do
expect(subject.excluded?).to eq false
end
end
context 'for member' do
subject { create :member_relationship }
specify do
expect(subject.excluded?).to eq false
end
end
context 'for excluded supporter' do
subject { create :excluded_supporter_relationship }
specify do
expect(subject.excluded?).to eq true
end
end
context 'for excluded member' do
subject { create :excluded_member_relationship }
specify do
expect(subject.excluded?).to eq true
end
end
end
end