Add method Relationship#excluded?
This commit is contained in:
parent
07c6d6c56c
commit
d00efc38a0
|
@ -47,6 +47,10 @@ class Relationship < ApplicationRecord
|
|||
status == :member
|
||||
end
|
||||
|
||||
def excluded?
|
||||
status == :excluded
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def membership_dates_are_not_in_future
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue