Change test / context / describe names

This commit is contained in:
Daniel Schädler 2019-04-28 17:37:25 +02:00
parent 9053251706
commit bbeda07028
3 changed files with 10 additions and 10 deletions

View File

@ -172,19 +172,19 @@ RSpec.describe TournamentsController, type: :controller do
expect(included_teams).to match_array(@teams) expect(included_teams).to match_array(@teams)
end end
context 'generates a group stage tournament' do context 'with parameter group_stage=true' do
before(:each) do before(:each) do
post :create, params: create_group_tournament_data post :create, params: create_group_tournament_data
body = deserialize_response response body = deserialize_response response
@group_stage_tournament = Tournament.find(body[:id]) @group_stage_tournament = Tournament.find(body[:id])
end end
it 'with all given teams in their respective groups' do it 'generates a group stage with all teams given in parameters' do
included_teams = @group_stage_tournament.stages.find_by(level: -1).teams included_teams = @group_stage_tournament.stages.find_by(level: -1).teams
expect(included_teams).to match_array(@teams16) expect(included_teams).to match_array(@teams16)
end end
it 'which is a stage' do it 'generates a group stage' do
group_stage = @group_stage_tournament.stages.find_by(level: -1) group_stage = @group_stage_tournament.stages.find_by(level: -1)
expect(group_stage).to be_a(Stage) expect(group_stage).to be_a(Stage)
end end

View File

@ -23,8 +23,8 @@ RSpec.describe AddGroupStageToTournament do
.and_return(@group_stage) .and_return(@group_stage)
end end
context 'Empty tournament' do context 'empty tournament' do
it 'context succeeds' do it 'succeeds' do
expect(empty_tournament_context).to be_a_success expect(empty_tournament_context).to be_a_success
end end
@ -42,12 +42,12 @@ RSpec.describe AddGroupStageToTournament do
.and_return(false) .and_return(false)
end end
it 'context fails' do it 'fails' do
expect(empty_tournament_context).to be_a_failure expect(empty_tournament_context).to be_a_failure
end end
end end
context 'Tournament where group stage is already generated' do context 'tournament where group stage is already generated' do
it 'does not add group stage' do it 'does not add group stage' do
expect(group_stage_tournament_context).to be_a_failure expect(group_stage_tournament_context).to be_a_failure
end end

View File

@ -7,7 +7,7 @@ RSpec.describe GroupStageService do
@teams2 = create_list(:team, 4) @teams2 = create_list(:team, 4)
@groups = Hash[1 => @teams1, 2 => @teams2].values @groups = Hash[1 => @teams1, 2 => @teams2].values
end end
describe 'generate_group_stage method' do describe '#generate_group_stage method' do
it 'returns a stage object' do it 'returns a stage object' do
group_stage = GroupStageService.generate_group_stage(@groups) group_stage = GroupStageService.generate_group_stage(@groups)
expect(group_stage).to be_a(Stage) expect(group_stage).to be_a(Stage)
@ -31,14 +31,14 @@ RSpec.describe GroupStageService do
end end
end end
describe 'get_group_object_from' do describe '#get_group_object_from' do
it 'returns a group' do it 'returns a group' do
group = GroupStageService.get_group_object_from(@teams1) group = GroupStageService.get_group_object_from(@teams1)
expect(group).to be_a(Group) expect(group).to be_a(Group)
end end
end end
describe 'generate_all_matches_between' do describe '#generate_all_matches_between' do
it 'generates a list of not started matches' do it 'generates a list of not started matches' do
matches = GroupStageService.generate_all_matches_between(@teams2) matches = GroupStageService.generate_all_matches_between(@teams2)
matches.each do |match| matches.each do |match|