Test returning unprocessable entity when error occurs in match population
This commit is contained in:
parent
0d85c057b6
commit
0c64839319
|
|
@ -158,6 +158,23 @@ RSpec.describe MatchesController, type: :controller do
|
|||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
end
|
||||
end
|
||||
|
||||
context 'PopulateMatchBelowAndSave fails' do
|
||||
before do
|
||||
@playoff_match = create(:running_playoff_match)
|
||||
expect(PopulateMatchBelowAndSave).to receive(:call).once.with(match: @playoff_match)
|
||||
.and_return(context)
|
||||
end
|
||||
|
||||
context 'when unsuccessful' do
|
||||
let(:context) { double(:context, success?: false) }
|
||||
|
||||
it 'returns unprocessable entity' do
|
||||
put :update, params: { id: @playoff_match.to_param }.merge(finished)
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue