Fix tournament index spec apply wrong auth header

because the user @owner doesn't have any private tournaments, therefore
the spec was pointless
This commit is contained in:
Thor77 2019-04-23 11:09:25 +02:00 committed by Malaber
parent 09ca262ab1
commit c4d03b52c3
1 changed files with 4 additions and 2 deletions

View File

@ -33,10 +33,12 @@ RSpec.describe TournamentsController, type: :controller do
end
it 'returns private tournaments owned by the authenticated user' do
apply_authentication_headers_for @user
apply_authentication_headers_for @another_user
get :index
tournaments = deserialize_response response
expect(tournaments.filter { |t| !t[:public] }).to match_array(Tournament.where(owner: @owner, public: false))
private_tournaments = Tournament.where(owner: @another_user, public: false).map { |t| t[:id] }
returned_private_tournaments = tournaments.filter { |t| !t[:public] }.map { |t| t[:id] }
expect(returned_private_tournaments).to match_array(private_tournaments)
end
it 'returns no private tournaments owned by another user' do