From 21c79665e1c48e04fb2c7d029ff9f0e709cb99e7 Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Sun, 26 May 2019 20:01:14 +0200 Subject: [PATCH] Check if .winner returns a Team This is done to prevent Test from succeeding if both .winner and .teams return nil --- spec/controllers/matches_controller_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/controllers/matches_controller_spec.rb b/spec/controllers/matches_controller_spec.rb index 63e6abc..ff12c79 100644 --- a/spec/controllers/matches_controller_spec.rb +++ b/spec/controllers/matches_controller_spec.rb @@ -96,6 +96,7 @@ RSpec.describe MatchesController, type: :controller do it 'populates 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(@running_playoff_match.winner).to be_a(Team) expect(match_below.teams).to include(@running_playoff_match.winner) end end