Save match_scores after editing them in tests
This commit is contained in:
parent
d0d38a7972
commit
0337b6fad8
|
|
@ -80,8 +80,10 @@ RSpec.describe MatchesController, type: :controller do
|
||||||
|
|
||||||
context 'stops the match' do
|
context 'stops the match' do
|
||||||
before do
|
before do
|
||||||
@running_playoff_match.match_scores.each_with_index { |ms, i| ms.points = i }
|
@running_playoff_match.match_scores.each_with_index do |ms, i|
|
||||||
@running_playoff_match.save
|
ms.points = i
|
||||||
|
ms.save
|
||||||
|
end
|
||||||
put :update, params: { id: @running_playoff_match.to_param }.merge(finished)
|
put :update, params: { id: @running_playoff_match.to_param }.merge(finished)
|
||||||
@running_playoff_match.reload
|
@running_playoff_match.reload
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -86,11 +86,16 @@ RSpec.describe PlayoffStageService do
|
||||||
@tournament = create(:stage_tournament, stage_count: 2)
|
@tournament = create(:stage_tournament, stage_count: 2)
|
||||||
@match = @tournament.stages.find { |s| s.level == 2 }.matches.first
|
@match = @tournament.stages.find { |s| s.level == 2 }.matches.first
|
||||||
@match.state = :finished
|
@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
|
@match.save
|
||||||
@companion_match = @tournament.stages.find { |s| s.level == 2 }.matches.second
|
@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.match_scores.each_with_index do |ms, i|
|
||||||
@companion_match.save
|
ms.points = i
|
||||||
|
ms.save
|
||||||
|
end
|
||||||
@match_to_find = @tournament.stages.find { |s| s.level == 1 }.matches.first
|
@match_to_find = @tournament.stages.find { |s| s.level == 1 }.matches.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue