Expect UserServiceError in spec
This commit is contained in:
parent
45ede9029e
commit
f08c4693ad
|
|
@ -12,7 +12,7 @@ RSpec.describe UserService do
|
||||||
it 'throws an exception' do
|
it 'throws an exception' do
|
||||||
expect do
|
expect do
|
||||||
@service.bet! create(:playoff_match), create(:team)
|
@service.bet! create(:playoff_match), create(:team)
|
||||||
end.to raise_error('The given team is not involved in the given match')
|
end.to raise_error(UserServiceError, 'The given team is not involved in the given match')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -37,6 +37,7 @@ RSpec.describe UserService do
|
||||||
expect(@user.bets).to include(bet)
|
expect(@user.bets).to include(bet)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'without a team' do
|
context 'without a team' do
|
||||||
context 'on a playoff stage' do
|
context 'on a playoff stage' do
|
||||||
it 'throws an exception' do
|
it 'throws an exception' do
|
||||||
|
|
@ -44,7 +45,7 @@ RSpec.describe UserService do
|
||||||
match.match_scores << create(:match_score, team: @team)
|
match.match_scores << create(:match_score, team: @team)
|
||||||
expect do
|
expect do
|
||||||
@service.bet! match, nil
|
@service.bet! match, nil
|
||||||
end.to raise_error('Betting on no team in a playoff match is not supported')
|
end.to raise_error(UserServiceError, 'Betting on no team in a playoff match is not supported')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue