Expect UserServiceError in spec

This commit is contained in:
Thor77 2019-06-14 14:28:31 +02:00
parent 45ede9029e
commit f08c4693ad
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
1 changed files with 3 additions and 2 deletions

View File

@ -12,7 +12,7 @@ RSpec.describe UserService do
it 'throws an exception' do
expect do
@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
@ -37,6 +37,7 @@ RSpec.describe UserService do
expect(@user.bets).to include(bet)
end
end
context 'without a team' do
context 'on a playoff stage' do
it 'throws an exception' do
@ -44,7 +45,7 @@ RSpec.describe UserService do
match.match_scores << create(:match_score, team: @team)
expect do
@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