From 11b1004053c090d3871b0551e50e13c2a40e50df Mon Sep 17 00:00:00 2001 From: Malaber Date: Sun, 12 Apr 2026 18:19:28 +0200 Subject: [PATCH] Stabilize match controller failure spec --- spec/controllers/matches_controller_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/controllers/matches_controller_spec.rb b/spec/controllers/matches_controller_spec.rb index 2d9482b..a283b63 100644 --- a/spec/controllers/matches_controller_spec.rb +++ b/spec/controllers/matches_controller_spec.rb @@ -195,7 +195,9 @@ RSpec.describe MatchesController, type: :controller do context 'PopulateMatchBelowAndSave fails' do before do - expect(PopulateMatchBelowAndSave).to receive(:call).once.with(match: @running_playoff_match) + expect(PopulateMatchBelowAndSave).to receive(:call).once.with( + match: have_attributes(id: @running_playoff_match.id) + ) .and_return(context) end @@ -204,7 +206,7 @@ RSpec.describe MatchesController, type: :controller do it 'returns unprocessable entity' do # mock match.winner to be the first team of the match to skip winner check here - allow(@running_playoff_match).to receive(:winner).and_return(@running_playoff_match.match_scores.first.team) + allow_any_instance_of(Match).to receive(:winner).and_return(@running_playoff_match.match_scores.first.team) put :update, params: { id: @running_playoff_match.to_param }.merge(finished) expect(response).to have_http_status(:unprocessable_entity)