remove create_new functionality, when exercise exists on CH but is not editable

This commit is contained in:
Karol
2019-12-13 16:43:19 +01:00
parent eb7a4d5933
commit f680916385
8 changed files with 44 additions and 56 deletions

View File

@ -42,17 +42,25 @@ describe ExerciseService::CheckExternal do
end
context 'when response contains a JSON with expected keys' do
let(:response) { {message: 'message', exercise_found: true, update_right: true}.to_json }
let(:response) { {exercise_found: true, update_right: true}.to_json }
it 'returns the correct hash' do
expect(check_external_service).to eql(error: false, message: 'message', exercise_found: true, update_right: true)
expect(check_external_service).to eql(error: false, message: I18n.t('exercises.export_codeharbor.check.exercise_found'), exercise_found: true, update_right: true)
end
context 'with different values' do
let(:response) { {message: 'message', exercise_found: false, update_right: false}.to_json }
context 'with exercise_found: false and no update_right' do
let(:response) { {exercise_found: false}.to_json }
it 'returns the correct hash' do
expect(check_external_service).to eql(error: false, message: 'message', exercise_found: false, update_right: false)
expect(check_external_service).to eql(error: false, message: I18n.t('exercises.export_codeharbor.check.no_exercise'), exercise_found: false)
end
end
context 'with exercise_found: true and update_right: false' do
let(:response) { {exercise_found: true, update_right: false}.to_json }
it 'returns the correct hash' do
expect(check_external_service).to eql(error: false, message: I18n.t('exercises.export_codeharbor.check.exercise_found_no_right'), exercise_found: true, update_right: false)
end
end
end