Keep owner of Matches in variable
This commit is contained in:
parent
43b3d2dfe8
commit
7d66aa3e9c
|
|
@ -5,8 +5,10 @@ require 'rails_helper'
|
||||||
RSpec.describe MatchesController, type: :controller do
|
RSpec.describe MatchesController, type: :controller do
|
||||||
before do
|
before do
|
||||||
@match = create(:match, state: :not_started)
|
@match = create(:match, state: :not_started)
|
||||||
|
@match_owner = @match.owner
|
||||||
@tournament = create(:group_stage_tournament, stage_count: 3)
|
@tournament = create(:group_stage_tournament, stage_count: 3)
|
||||||
@running_playoff_match = @tournament.stages.find { |s| s.level == 3 }.matches.first
|
@running_playoff_match = @tournament.stages.find { |s| s.level == 3 }.matches.first
|
||||||
|
@running_playoff_match_owner = @running_playoff_match.owner
|
||||||
@match.match_scores = create_pair(:match_score)
|
@match.match_scores = create_pair(:match_score)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -40,7 +42,7 @@ RSpec.describe MatchesController, type: :controller do
|
||||||
|
|
||||||
context 'as owner' do
|
context 'as owner' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
apply_authentication_headers_for @match.owner
|
apply_authentication_headers_for @match_owner
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with valid params' do
|
context 'with valid params' do
|
||||||
|
|
@ -75,7 +77,7 @@ RSpec.describe MatchesController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
apply_authentication_headers_for @running_playoff_match.owner
|
apply_authentication_headers_for @running_playoff_match_owner
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'stops the match' do
|
it 'stops the match' do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue