Move stopping of matches test

This commit is contained in:
Daniel Schädler 2019-05-23 13:20:59 +02:00
parent d61b3b2b63
commit 9f92ca7e5b
1 changed files with 33 additions and 35 deletions

View File

@ -57,17 +57,8 @@ RSpec.describe MatchesController, type: :controller do
body = deserialize_response response
expect(body[:state]).to eq(valid_update[:state])
end
end
context 'with invalid params' do
it 'renders an unprocessable entity response' do
put :update, params: { id: @match.to_param }.merge(invalid_update)
expect(response).to have_http_status(:unprocessable_entity)
end
end
end
context 'as another owner' do
context 'on a running playoff match' do
let(:finished) do
{
state: 'finished'
@ -78,7 +69,6 @@ RSpec.describe MatchesController, type: :controller do
apply_authentication_headers_for @running_playoff_match.owner
end
context 'stops the match' do
before do
@running_playoff_match.match_scores.each_with_index do |ms, i|
ms.points = i
@ -102,6 +92,14 @@ RSpec.describe MatchesController, type: :controller do
end
end
context 'with invalid params' do
it 'renders an unprocessable entity response' do
put :update, params: { id: @match.to_param }.merge(invalid_update)
expect(response).to have_http_status(:unprocessable_entity)
end
end
end
context 'as another user' do
context 'with valid params' do
before(:each) do