From 07f5388f6d5b857a784098a1ef7b97d9e3e3669a Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Tue, 11 Jun 2019 23:59:23 +0200 Subject: [PATCH] Add Tests for TournamentService --- spec/services/tournament_service_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 spec/services/tournament_service_spec.rb diff --git a/spec/services/tournament_service_spec.rb b/spec/services/tournament_service_spec.rb new file mode 100644 index 0000000..65abd35 --- /dev/null +++ b/spec/services/tournament_service_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe TournamentService do + describe '#calculate_default_amount_of_teams_advancing' do + before do + @instant_finalists_amount, @intermediate_round_participants_amount = + TournamentService.calculate_default_amount_of_teams_advancing(32, 5) + end + + it 'accurately calculates @instant_finalists_amount' do + expect(@instant_finalists_amount).to eq(30) + end + + it 'accurately calculates @intermediate_round_participants_amount' do + expect(@intermediate_round_participants_amount).to eq(4) + end + end +end