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)
end
context 'generates a group stage tournament' do
context 'with parameter group_stage=true' do
before(:each) do
post :create, params: create_group_tournament_data
body = deserialize_response response
@group_stage_tournament = Tournament.find(body[:id])
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
expect(included_teams).to match_array(@teams16)
end
it 'which is a stage' do
it 'generates a group stage' do
group_stage = @group_stage_tournament.stages.find_by(level: -1)
expect(group_stage).to be_a(Stage)
end

View File

@ -23,8 +23,8 @@ RSpec.describe AddGroupStageToTournament do
.and_return(@group_stage)
end
context 'Empty tournament' do
it 'context succeeds' do
context 'empty tournament' do
it 'succeeds' do
expect(empty_tournament_context).to be_a_success
end
@ -42,12 +42,12 @@ RSpec.describe AddGroupStageToTournament do
.and_return(false)
end
it 'context fails' do
it 'fails' do
expect(empty_tournament_context).to be_a_failure
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
expect(group_stage_tournament_context).to be_a_failure
end

View File

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