diff --git a/spec/controllers/statistics_controller_spec.rb b/spec/controllers/statistics_controller_spec.rb index ff43d90..36673b2 100644 --- a/spec/controllers/statistics_controller_spec.rb +++ b/spec/controllers/statistics_controller_spec.rb @@ -15,12 +15,14 @@ RSpec.describe StatisticsController, type: :controller do before do @tournament = create(:group_stage_tournament) @group_stage = @tournament.stages.find_by(level: -1) - @most_dominant_score = GroupScore.new team: @tournament.teams.first, - group_points: 100, - scored_points: 100, received_points: 0 - @least_dominant_score = GroupScore.new team: @tournament.teams.first, - group_points: 0, - scored_points: 0, received_points: 100 + @most_dominant_score = create(:group_score, + team: @tournament.teams.first, + group_points: 100, + scored_points: 100, received_points: 0) + @least_dominant_score = create(:group_score, + team: @tournament.teams.first, + group_points: 0, + scored_points: 0, received_points: 100) @tournament.stages.first.groups.first.group_scores << @most_dominant_score @tournament.stages.first.groups.first.group_scores << @least_dominant_score @tournament.save! diff --git a/spec/services/statistics_service_spec.rb b/spec/services/statistics_service_spec.rb index 6e53708..ec6b3fa 100644 --- a/spec/services/statistics_service_spec.rb +++ b/spec/services/statistics_service_spec.rb @@ -6,12 +6,12 @@ RSpec.describe StatisticsService do tournament = create(:tournament) group_stage = create(:group_stage) group = group_stage.groups.first - @most_dominant_score = GroupScore.new team: create(:team), - group_points: 100, - scored_points: 100, received_points: 0 - @least_dominant_score = GroupScore.new team: create(:team), - group_points: 0, - scored_points: 0, received_points: 100 + @most_dominant_score = create(:group_score, + group_points: 100, + scored_points: 100, received_points: 0) + @least_dominant_score = create(:group_score, + group_points: 0, + scored_points: 0, received_points: 100) group.group_scores << @most_dominant_score group.group_scores << @least_dominant_score tournament.stages << group_stage