Test tournament.matches method
This commit is contained in:
parent
b001817bac
commit
82e4ff90dc
|
|
@ -30,4 +30,29 @@ RSpec.describe Tournament, type: :model do
|
||||||
it { should have_many :teams }
|
it { should have_many :teams }
|
||||||
it { should have_many :stages }
|
it { should have_many :stages }
|
||||||
end
|
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
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue