Add method to check if match_score is part of a group match

This commit is contained in:
Daniel Schädler 2019-05-27 23:25:02 +02:00
parent d556e3e833
commit 564cec2820
2 changed files with 14 additions and 0 deletions

View File

@ -5,4 +5,8 @@ class MatchScore < ApplicationRecord
belongs_to :team
delegate :owner, to: :match
def part_of_group_match?
match.group_match?
end
end

View File

@ -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