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