diff --git a/spec/controllers/matches_controller_spec.rb b/spec/controllers/matches_controller_spec.rb index 35dd4e0..ee47017 100644 --- a/spec/controllers/matches_controller_spec.rb +++ b/spec/controllers/matches_controller_spec.rb @@ -80,8 +80,10 @@ RSpec.describe MatchesController, type: :controller do context 'stops the match' do before do - @running_playoff_match.match_scores.each_with_index { |ms, i| ms.points = i } - @running_playoff_match.save + @running_playoff_match.match_scores.each_with_index do |ms, i| + ms.points = i + ms.save + end put :update, params: { id: @running_playoff_match.to_param }.merge(finished) @running_playoff_match.reload end diff --git a/spec/services/playoff_stage_service_spec.rb b/spec/services/playoff_stage_service_spec.rb index a5de8fd..3e8812f 100644 --- a/spec/services/playoff_stage_service_spec.rb +++ b/spec/services/playoff_stage_service_spec.rb @@ -86,11 +86,16 @@ RSpec.describe PlayoffStageService do @tournament = create(:stage_tournament, stage_count: 2) @match = @tournament.stages.find { |s| s.level == 2 }.matches.first @match.state = :finished - @match.match_scores.each_with_index { |ms, i| ms.points = i } + @match.match_scores.each_with_index do |ms, i| + ms.points = i + ms.save + end @match.save @companion_match = @tournament.stages.find { |s| s.level == 2 }.matches.second - @companion_match.match_scores.each_with_index { |ms, i| ms.points = i } - @companion_match.save + @companion_match.match_scores.each_with_index do |ms, i| + ms.points = i + ms.save + end @match_to_find = @tournament.stages.find { |s| s.level == 1 }.matches.first end