Test stopping of matches
This commit is contained in:
parent
6f8cb90dde
commit
aac0bcb8c8
|
|
@ -80,12 +80,22 @@ RSpec.describe MatchesController, type: :controller do
|
||||||
apply_authentication_headers_for @running_playoff_match_owner
|
apply_authentication_headers_for @running_playoff_match_owner
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'stops the match' do
|
context 'stops the match' do
|
||||||
|
before do
|
||||||
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
|
||||||
|
|
||||||
|
it 'updates the matches status' do
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
expect(@running_playoff_match.state).to eq(finished[:state])
|
expect(@running_playoff_match.state).to eq(finished[:state])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'fills the match below' do
|
||||||
|
match_below = @tournament.stages.find { |s| s.level == 2 }.matches.find { |m| m.position == @running_playoff_match.position / 2 }.reload
|
||||||
|
expect(match_below.teams).to include(@running_playoff_match.winner)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as another user' do
|
context 'as another user' do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue