Add method to check if match_score is part of a group match
This commit is contained in:
parent
5b2a969857
commit
e25292ea96
|
|
@ -5,4 +5,8 @@ class MatchScore < ApplicationRecord
|
||||||
belongs_to :team
|
belongs_to :team
|
||||||
|
|
||||||
delegate :owner, to: :match
|
delegate :owner, to: :match
|
||||||
|
|
||||||
|
def part_of_group_match?
|
||||||
|
match.group_match?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,14 @@ RSpec.describe MatchScore, type: :model do
|
||||||
it { should belong_to :match }
|
it { should belong_to :match }
|
||||||
it { should belong_to :team }
|
it { should belong_to :team }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#part_of_group_match?' do
|
||||||
|
it 'is part of a group match' do
|
||||||
|
expect(create(:running_group_match).match_scores.first.part_of_group_match?).to be(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'isn\'t part of a group match' do
|
||||||
|
expect(create(:running_playoff_match).match_scores.first.part_of_group_match?).to be(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue