From c4d03b52c3300ded5512851dee67846b1bca3677 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Tue, 23 Apr 2019 11:09:25 +0200 Subject: [PATCH] Fix tournament index spec apply wrong auth header because the user @owner doesn't have any private tournaments, therefore the spec was pointless --- spec/controllers/tournaments_controller_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/controllers/tournaments_controller_spec.rb b/spec/controllers/tournaments_controller_spec.rb index 5159f5c..58e9a62 100644 --- a/spec/controllers/tournaments_controller_spec.rb +++ b/spec/controllers/tournaments_controller_spec.rb @@ -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