Test tournament.matches method

This commit is contained in:
Daniel Schädler 2019-10-26 01:22:52 +02:00
parent b001817bac
commit 82e4ff90dc
1 changed files with 25 additions and 0 deletions

View File

@ -30,4 +30,29 @@ RSpec.describe Tournament, type: :model do
it { should have_many :teams }
it { should have_many :stages }
end
describe '#matches' do
context 'group stage tournament' do
before do
@tournament = create(:group_stage_tournament)
end
it 'returns only matches' do
@tournament.matches.each do |m|
expect(m).to be_a Match
end
end
end
context 'stage tournament' do
before do
@tournament = create(:stage_tournament)
end
it 'returns only matches' do
@tournament.matches.each do |m|
expect(m).to be_a Match
end
end
end
end
end