From 813ab047045a92054fbe4fde0fff452c90e304fc Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Tue, 16 Apr 2019 20:18:50 +0200 Subject: [PATCH] Add Test for match state change --- spec/controllers/match_scores_controller_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/controllers/match_scores_controller_spec.rb b/spec/controllers/match_scores_controller_spec.rb index 1d35d28..a416f77 100644 --- a/spec/controllers/match_scores_controller_spec.rb +++ b/spec/controllers/match_scores_controller_spec.rb @@ -41,6 +41,12 @@ RSpec.describe MatchScoresController, type: :controller do expect(@match_score.points).to eq(valid_update[:points]) end + it 'updates the matches state' do + put :update, params: { id: @match_score.to_param }.merge(valid_update) + @match_score.reload + expect(@match_score.match.state).to eq('in_progress') + end + it 'renders a response with the updated team' do put :update, params: { id: @match_score.to_param }.merge(valid_update) expect(response).to be_successful