Delegate owner of team to tournament again
This commit is contained in:
parent
27709f0136
commit
b36e3c4251
|
|
@ -7,8 +7,5 @@ class Team < ApplicationRecord
|
||||||
|
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
|
|
||||||
def owner
|
delegate :owner, to: :tournament
|
||||||
match_scores.first.owner
|
|
||||||
# this will produce errors if we make teams reusable
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe TeamsController, type: :controller do
|
RSpec.describe TeamsController, type: :controller do
|
||||||
before do
|
before do
|
||||||
match_score = create(:match_score)
|
@team = create(:tournament).teams.first
|
||||||
@team = match_score.team
|
|
||||||
@owner = @team.owner
|
@owner = @team.owner
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ FactoryBot.define do
|
||||||
evaluator.match_count == -1 ? 2**stage.level : evaluator.match_count)
|
evaluator.match_count == -1 ? 2**stage.level : evaluator.match_count)
|
||||||
stage.matches.each_with_index do |match, i|
|
stage.matches.each_with_index do |match, i|
|
||||||
match.position = i
|
match.position = i
|
||||||
match.save
|
match.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue