Change return for 0 teams to exception
This commit is contained in:
parent
a449e0193a
commit
d3d572ea1b
|
|
@ -8,7 +8,7 @@ class MatchService
|
|||
def self.generate_matches(teams)
|
||||
if teams.empty?
|
||||
# should be prevented by controller
|
||||
return
|
||||
raise 'Cannot generate Matches without teams'
|
||||
end
|
||||
|
||||
if teams.size == 1
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ RSpec.describe MatchService do
|
|||
end
|
||||
end
|
||||
|
||||
it 'generates no matches for 0 teams' do
|
||||
expect(MatchService.generate_matches([])). to eq(nil)
|
||||
it 'raises an exception for for 0 teams' do
|
||||
expect { MatchService.generate_matches([]) }. to raise_error 'Cannot generate Matches without teams'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue