mumuki-laboratory 9.1.1 → 9.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mumuki_laboratory/application/faqs.js +6 -6
  3. data/app/assets/javascripts/mumuki_laboratory/application/profile.js +7 -15
  4. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_breadcrumb.scss +4 -28
  5. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_discussion.scss +0 -25
  6. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_faqs.scss +4 -3
  7. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids.scss +0 -1
  8. data/app/controllers/concerns/organizations_controller_template.rb +1 -0
  9. data/app/controllers/exam_authorization_requests_controller.rb +1 -5
  10. data/app/controllers/users_controller.rb +4 -0
  11. data/app/helpers/discussions_helper.rb +10 -2
  12. data/app/helpers/profile_helper.rb +1 -1
  13. data/app/helpers/user_menu_helper.rb +4 -0
  14. data/app/views/discussions/_description_message.html.erb +1 -1
  15. data/app/views/discussions/_message.html.erb +1 -1
  16. data/app/views/discussions/_new_message.html.erb +1 -1
  17. data/app/views/discussions/new.html.erb +1 -1
  18. data/app/views/exam_authorization_requests/_approved.html.erb +1 -0
  19. data/app/views/exam_authorization_requests/_pending.html.erb +4 -0
  20. data/app/views/exam_authorization_requests/_rejected.html.erb +1 -0
  21. data/app/views/exam_registrations/show.html.erb +1 -1
  22. data/app/views/exercises/_read_only.html.erb +3 -3
  23. data/app/views/faqs/index.html.erb +1 -1
  24. data/app/views/layouts/_kids.html.erb +2 -2
  25. data/app/views/layouts/_test_results.html.erb +1 -1
  26. data/app/views/layouts/_user_menu.html.erb +1 -0
  27. data/app/views/layouts/application.html.erb +1 -1
  28. data/app/views/notifications/_exam_authorization_request.html.erb +1 -1
  29. data/app/views/users/activity.html.erb +8 -6
  30. data/app/views/users/exam_authorizations.html.erb +42 -0
  31. data/config/routes.rb +2 -1
  32. data/lib/mumuki/laboratory/locales/en.yml +6 -4
  33. data/lib/mumuki/laboratory/locales/es-CL.yml +6 -4
  34. data/lib/mumuki/laboratory/locales/es.yml +6 -4
  35. data/lib/mumuki/laboratory/locales/pt.yml +6 -4
  36. data/lib/mumuki/laboratory/version.rb +1 -1
  37. data/spec/controllers/exam_authorization_requests_controller_spec.rb +1 -18
  38. data/spec/controllers/organizations_api_controller_spec.rb +3 -1
  39. data/spec/controllers/users_controller_spec.rb +1 -0
  40. data/spec/features/notifications_flow_spec.rb +2 -3
  41. data/spec/features/profile_flow_spec.rb +2 -9
  42. data/spec/features/user_activity_flow_spec.rb +30 -10
  43. data/spec/helpers/with_navigation_spec.rb +37 -0
  44. metadata +122 -119
  45. data/app/views/exam_authorization_requests/show.html.erb +0 -17
@@ -5,7 +5,7 @@
5
5
  <div class="row">
6
6
  <%= render partial: 'layouts/user_menu' %>
7
7
 
8
- <div class="col-md-9">
8
+ <div class="col-md-9 mu-tab-body">
9
9
  <div class="mu-user-header">
10
10
  <h1><%= t(:activity) %></h1>
11
11
  </div>
@@ -17,11 +17,13 @@
17
17
  stats: exercises_activity_stats
18
18
  } %>
19
19
 
20
- <%= render partial: 'activity_indicator',
21
- locals: {
22
- title: t(:forum),
23
- stats: messages_activity_stats
24
- } %>
20
+ <% if Organization.current.forum_enabled? %>
21
+ <%= render partial: 'activity_indicator',
22
+ locals: {
23
+ title: t(:forum),
24
+ stats: messages_activity_stats
25
+ } %>
26
+ <% end %>
25
27
  </div>
26
28
  <div class="col-lg-4 mu-tab-body">
27
29
  <div class="nav nav-pills flex-column">
@@ -0,0 +1,42 @@
1
+ <%= content_for :breadcrumbs do %>
2
+ <%= breadcrumbs_for_my_account %>
3
+ <% end %>
4
+
5
+ <div class="row">
6
+ <%= render partial: 'layouts/user_menu' %>
7
+
8
+ <div class="col-md-9 mu-tab-body">
9
+ <div class="mu-user-header">
10
+ <h1><%= t(:exam_registrations) %></h1>
11
+ </div>
12
+ <% if @exam_authorization_requests.empty? %>
13
+ <div class="mu-tab-body">
14
+ <%= t :exams_will_be_here %>
15
+ </div>
16
+ <% else %>
17
+ <div class="col-md-12">
18
+ <div class="accordion" id="exam_authorization_accordion">
19
+ <% @exam_authorization_requests.each_with_index do |it, index| %>
20
+ <div class="accordion-item">
21
+ <h2 class="accordion-header" id="<%= "exam_authorization_accordion_item_#{index}" %>">
22
+ <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#<%= "exam_authorization_collapse_item_#{index}" %>" aria-expanded="false" aria-controls="<%= "exam_authorization_collapse_item_#{index}" %>">
23
+ <span class="fa fa-fw fa-<%= it.icon[:class] %> text-<%= it.icon[:type] %>" data-bs-toggle="tooltip" title="<%= t(it.status).humanize %>"></span>
24
+ <span class="divider-vertical"></span>
25
+ <span><strong><%= it.exam_registration.description %></strong> - <small><%= l(it.exam.start_time, format: :long) %></small></span>
26
+ </button>
27
+ </h2>
28
+ <div id="<%= "exam_authorization_collapse_item_#{index}" %>" class="accordion-collapse collapse" aria-labelledby="<%= "exam_authorization_accordion_item_#{index}" %>" data-bs-parent="#exam_authorization_accordion">
29
+ <div class="accordion-body p-0">
30
+ <div class="m-0 border-bottom-0 border-top-0 border-right-0 bs-callout bs-callout-<%= it.icon[:type] %>">
31
+ <p><%= render partial: "exam_authorization_requests/#{it.status}", locals: { authorization_request: it } %></p>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ <% end %>
37
+ </div>
38
+
39
+ </div>
40
+ <% end %>
41
+ </div>
42
+ </div>
data/config/routes.rb CHANGED
@@ -24,7 +24,7 @@ Rails.application.routes.draw do
24
24
  get '/discussions/messages/preview', to: 'discussions_messages#preview', as: :preview_discussion_message
25
25
 
26
26
  resources :exam_registrations, only: [:show]
27
- resources :exam_authorization_requests, only: [:show, :create, :update]
27
+ resources :exam_authorization_requests, only: [:create, :update]
28
28
 
29
29
  resources :book, only: [:show]
30
30
  resources :chapters, only: [:show] do
@@ -68,6 +68,7 @@ Rails.application.routes.draw do
68
68
  get :discussions
69
69
  get :activity
70
70
  get :certificates
71
+ get :exam_authorizations
71
72
 
72
73
  end
73
74
 
@@ -108,15 +108,17 @@ en:
108
108
  error_500: 500 error
109
109
  error_description: This is known as a <span class="error-link">%{error}</span>.
110
110
  errored: Oops, your solution didn't work
111
+ exam_authorization_pending_explanation_html: You have until <strong>%{end_time}</strong> to register. After that date, your request will be processed and you will receive a confirmation. <br> Don't forget to check the notifications!
111
112
  exam_authorization_request_approved_html: Your request was approved, don't forget to log in at <strong>%{date}</strong>. Good luck!
112
113
  exam_authorization_request_created: Your registration to the exam has been saved!
113
- exam_authorization_request_rejected: Your request was rejected.
114
+ exam_authorization_request_rejected: Your request was rejected because you didn't meet the requirements.
114
115
  exam_authorization_request_saved: Your registration to the exam has been updated!
115
116
  exam_authorization_request_updated: Your registration to %{description} has been updated
116
117
  exam_registration_choose_exam: Choose date and time to attend to the exam
117
118
  exam_registration_explanation_html: You have until <strong>%{date}</strong> to register. After that date, your request will be processed and you will receive a confirmation. <br> Don't forget to check the notifications!
118
119
  exam_registration_open: Registrations open for %{description}!
119
120
  exam_registration_to: Registration to %{description}
121
+ exams_will_be_here: Your exams in the organization will appear here.
120
122
  exams: Exams
121
123
  exercise: Exercise
122
124
  exercises: Exercises
@@ -184,9 +186,6 @@ en:
184
186
  male: Male
185
187
  manual_evaluation_pending: Thanks for submitting your solution! It will be revised by the course teachers soon
186
188
  medal: Medal
187
- message_count:
188
- one: 1 message
189
- other: '%{count} messages'
190
189
  message: Message
191
190
  message_deleted: This message was deleted because it %{motive}, which violates the %{forum_terms}.
192
191
  messages: Messages
@@ -253,6 +252,9 @@ en:
253
252
  progress: Progresss
254
253
  read: Read
255
254
  refresh_or_wait: Please press F5 if results are not displayed after a few seconds
255
+ reply_count:
256
+ one: 1 reply
257
+ other: '%{count} replies'
256
258
  requires_attention: Requires attention
257
259
  reset_query: Clear current search filters
258
260
  responses_count_asc: By less validated replies
@@ -108,15 +108,17 @@ es-CL:
108
108
  internal_server_error: ¡Ups! Algo no anduvo bien
109
109
  not_found: ¡Ups! La página no existe
110
110
  errored: ¡Ups! Tu solución no se puede ejecutar
111
+ exam_authorization_pending_explanation_html: Tienes tiempo hasta el <strong>%{end_time}</strong> para inscribirte. Pasada esa fecha, tu solicitud será evaluada y recibirás una confirmación. <br> ¡No olvides revisar las notificaciones!
111
112
  exam_authorization_request_approved_html: Tu solicitud fue aprobada, no olvides conectarte el <strong>%{date}</strong>. ¡Buena suerte!
112
113
  exam_authorization_request_created: ¡Tu inscripción al exámen se registró exitosamente!
113
- exam_authorization_request_rejected: Tu solicitud fue rechazada.
114
+ exam_authorization_request_rejected: Tu solicitud fue rechazada porque no cumpliste con los requisitos para rendir el examen.
114
115
  exam_authorization_request_saved: ¡Tu inscripción al exámen se modificó exitosamente!
115
116
  exam_authorization_request_updated: Hay novedades sobre tu inscripción a %{description}
116
117
  exam_registration_choose_exam: Seleccioná día y horario en el que te gustaría rendir el exámen
117
118
  exam_registration_explanation_html: Tienes tiempo hasta el <strong>%{date}</strong> para inscribirte. Pasada esa fecha, tu solicitud será evaluada y recibirás una confirmación. <br> ¡No olvides revisar las notificaciones!
118
119
  exam_registration_open: ¡Ya puedes inscribirte a %{description}!
119
120
  exam_registration_to: Inscripción a %{description}
121
+ exams_will_be_here: Tus exámenes en esta organización aparecerán acá
120
122
  exams: Exámenes
121
123
  exercise: Ejercicio
122
124
  exercise_count: ejercicios
@@ -184,9 +186,6 @@ es-CL:
184
186
  male: Hombre
185
187
  manual_evaluation_pending: ¡Gracias por enviar tu solución! Tus docentes la corregirán pronto
186
188
  medal: Medalla
187
- message_count:
188
- one: 1 mensaje
189
- other: '%{count} mensajes'
190
189
  message: Mensaje
191
190
  message_deleted: Este mensaje fue eliminado porque %{motive}, lo cual infringe las %{forum_terms}.
192
191
  messages: Mensajes
@@ -260,6 +259,9 @@ es-CL:
260
259
  read: Leído
261
260
  read_messages: Ver mensajes
262
261
  refresh_or_wait: Si no se muestra automáticamente en unos segundos, presiona F5
262
+ reply_count:
263
+ one: 1 respuesta
264
+ other: '%{count} respuestas'
263
265
  reset_query: Borrar los filtros de búsqueda actuales
264
266
  restart: Reiniciar
265
267
  results_hidden: ¡Tu solución fue enviada con éxito!
@@ -116,15 +116,17 @@ es:
116
116
  internal_server_error: ¡Ups! Algo no anduvo bien
117
117
  not_found: ¡Ups! La página no existe
118
118
  errored: ¡Ups! Tu solución no se puede ejecutar
119
+ exam_authorization_pending_explanation_html: Tenés tiempo hasta el <strong>%{end_time}</strong> para cambiar el turno haciendo click <strong><a href="%{edit_path}">acá</a></strong>. Pasada esa fecha, tu solicitud será evaluada y recibirás una confirmación. <br> ¡No te olvides de revisar las notificaciones!
119
120
  exam_authorization_request_approved_html: Tu solicitud fue aprobada, no olvides conectarte el <strong>%{date}</strong>. ¡Buena suerte!
120
121
  exam_authorization_request_created: ¡Tu inscripción al exámen se registró exitosamente!
121
- exam_authorization_request_rejected: Tu solicitud fue rechazada.
122
+ exam_authorization_request_rejected: Tu solicitud fue rechazada porque no cumpliste con los requisitos para rendir el examen.
122
123
  exam_authorization_request_saved: ¡Tu inscripción al exámen se modificó exitosamente!
123
124
  exam_authorization_request_updated: Hay novedades sobre tu inscripción a %{description}
124
125
  exam_registration_choose_exam: Seleccioná día y horario en el que te gustaría rendir el exámen
125
126
  exam_registration_explanation_html: Tenés tiempo hasta el <strong>%{date}</strong> para inscribirte. Pasada esa fecha, tu solicitud será evaluada y recibirás una confirmación. <br> ¡No te olvides de revisar las notificaciones!
126
127
  exam_registration_open: ¡Ya podés inscribirte a %{description}!
127
128
  exam_registration_to: Inscripción a %{description}
129
+ exams_will_be_here: Tus exámenes en esta organización aparecerán acá
128
130
  exams: Exámenes
129
131
  exercise: Ejercicio
130
132
  exercise_count: ejercicios
@@ -195,9 +197,6 @@ es:
195
197
  male: Hombre
196
198
  manual_evaluation_pending: ¡Gracias por enviar tu solución! Tus docentes la corregirán pronto
197
199
  medal: Medalla
198
- message_count:
199
- one: 1 mensaje
200
- other: '%{count} mensajes'
201
200
  message: Mensaje
202
201
  message_deleted: Este mensaje fue eliminado porque %{motive}, lo cual infringe las %{forum_terms}.
203
202
  messages: Mensajes
@@ -272,6 +271,9 @@ es:
272
271
  read: Leido
273
272
  read_messages: Ver mensajes
274
273
  refresh_or_wait: Si no se muestra automáticamente en unos segundos, presioná F5
274
+ reply_count:
275
+ one: 1 respuesta
276
+ other: '%{count} respuestas'
275
277
  requires_attention: Requiere atención
276
278
  reset_query: Borrar los filtros de búsqueda actuales
277
279
  responses_count_asc: Con menos respuestas validadas
@@ -111,15 +111,17 @@ pt:
111
111
  error_500: erro 500
112
112
  error_description: Isto é o que é conhecido como <span class = "error-link"> %{error} </ span>.
113
113
  errored: Opa! Sua solução não pode ser executada
114
+ exam_authorization_pending_explanation_html: Você tem tempo até <strong>%{date}</strong> para se inscrever. Após essa data, sua inscrição será avaliada e você receberá uma confirmação. <br> Não se esqueça de verificar as notificações!
114
115
  exam_authorization_request_approved_html: Sua solicitação foi aprovada, não se esqueça de conectar em <strong>%{date}</strong>. Boa sorte!
115
116
  exam_authorization_request_created: Seu registro de exame foi salvo com sucesso!
116
- exam_authorization_request_rejected: Seu pedido foi rejeitado.
117
+ exam_authorization_request_rejected: Sua solicitação foi rejeitada porque você não atendeu aos requisitos.
117
118
  exam_authorization_request_saved: Seu registro de exame foi modificado com sucesso!
118
119
  exam_authorization_request_updated: Há notícias sobre seu registro para %{description}
119
120
  exam_registration_choose_exam: Selecione o dia e a hora em que gostaria de fazer o exame
120
121
  exam_registration_explanation_html: Você tem tempo até <strong>%{date}</strong> para se inscrever. Após essa data, sua inscrição será avaliada e você receberá uma confirmação. <br> Não se esqueça de verificar as notificações!
121
122
  exam_registration_open: "¡Inscrições abertas para %{description}!"
122
123
  exam_registration_to: Inscrição a %{description}
124
+ exams_will_be_here: Seus Examesca nesta organização aparecerão aqui
123
125
  exams: Examesca
124
126
  exercise: Exercício
125
127
  exercise_count: exercícios
@@ -188,9 +190,6 @@ pt:
188
190
  male: Masculino
189
191
  manual_evaluation_pending: Obrigado por enviar sua solução! Seus professores irão corrigi-lo em breve
190
192
  medal: Medalha
191
- message_count:
192
- one: 1 mensagem
193
- other: '%{count} mensagens'
194
193
  message: Mensagem
195
194
  message_deleted: Esta mensagem foi excluída porque %{motive}, o que viola as %{forum_terms}.
196
195
  messages: Mensagens
@@ -263,6 +262,9 @@ pt:
263
262
  read: Ler
264
263
  read_messages: Ver mensagens
265
264
  refresh_or_wait: Se não mostrar automaticamente em alguns segundos, pressione F5
265
+ reply_count:
266
+ one: 1 resposta
267
+ other: '%{count} respostas'
266
268
  requires_attention: Requer atenção
267
269
  reset_query: Limpar filtros de pesquisa atuais
268
270
  restart: Reiniciar
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Laboratory
3
- VERSION = '9.1.1'
3
+ VERSION = '9.3.1'
4
4
  end
5
5
  end
@@ -7,23 +7,6 @@ describe ExamAuthorizationRequestsController, type: :controller, organization_wo
7
7
 
8
8
  before { set_current_user! user }
9
9
 
10
- describe 'show' do
11
- context 'when authorization does not exist' do
12
- before { get :show, params: {id: 0} }
13
- it { expect(response.status).to eq 404 }
14
- end
15
-
16
- context 'when authorization exists' do
17
- let(:exam_authorization_request) { create(:exam_authorization_request, user: user, exam_registration: exam_registration) }
18
- let!(:notification) { create(:notification, target: exam_authorization_request, user: user) }
19
-
20
- before { get :show, params: {id: exam_authorization_request.id} }
21
-
22
- it { expect(response.status).to eq 200 }
23
- it { expect(notification.reload.read).to be_truthy }
24
- end
25
- end
26
-
27
10
  describe 'create' do
28
11
  let!(:notification) { create(:notification, target: exam_registration, user: user) }
29
12
 
@@ -33,7 +16,7 @@ describe ExamAuthorizationRequestsController, type: :controller, organization_wo
33
16
  }
34
17
  end
35
18
 
36
- it { expect(response.status).to eq 204 }
19
+ it { expect(response.status).to eq 302 }
37
20
  it { expect(exam_registration.authorization_requests.length).to be 1 }
38
21
  it { expect(notification.reload.read).to be_truthy }
39
22
  end
@@ -143,7 +143,8 @@ describe Api::OrganizationsController, type: :controller, organization_workspace
143
143
  logo_url: 'http://a-logo-url.com',
144
144
  theme_stylesheet: '.theme { color: red }',
145
145
  extension_javascript: 'window.a = function() { }',
146
- terms_of_service: 'A TOS'}
146
+ terms_of_service: 'A TOS',
147
+ faqs: 'some faqs'}
147
148
  end
148
149
 
149
150
  it { expect(organization.public?).to eq false }
@@ -153,6 +154,7 @@ describe Api::OrganizationsController, type: :controller, organization_workspace
153
154
  it { expect(organization.theme_stylesheet).to eq ".theme { color: red }" }
154
155
  it { expect(organization.extension_javascript).to eq "window.a = function() { }" }
155
156
  it { expect(organization.terms_of_service).to eq 'A TOS' }
157
+ it { expect(organization.faqs).to eq 'some faqs' }
156
158
  end
157
159
 
158
160
  context 'with missing values' do
@@ -18,4 +18,5 @@ describe UsersController, type: :controller, organization_workspace: :test do
18
18
  it { expect(User.last.first_name).to eq 'foo' }
19
19
  it { expect(User.last.verified_first_name).to be_nil }
20
20
  end
21
+
21
22
  end
@@ -37,10 +37,9 @@ feature 'Notifications Flow', organization_workspace: :test do
37
37
  expect(page).to have_text 'Choose date and time to attend to the exam'
38
38
  end
39
39
 
40
- scenario 'removes notification after target is processed' do
41
- # Notification for exam authorization request is considered read after user click
40
+ scenario 'does not remove exam authorization notification after click it ' do
42
41
  find_notification_number(1).click
43
- expect(notifications_bell).to have_text('1')
42
+ expect(notifications_bell).to have_text('2')
44
43
  end
45
44
  end
46
45
  end
@@ -73,19 +73,12 @@ feature 'Profile Flow', organization_workspace: :test do
73
73
  context 'user with uncompleted profile after saving' do
74
74
  before { user.update! last_name: 'last_name', birthdate: Time.now - 20.years, gender: 'female' }
75
75
 
76
- let(:button_options) do
77
- # Match :first is used because there are two buttons: mobile and desktop.
78
- { class: 'mu-edit-profile-btn', match: :first }.tap do |options|
79
- options.merge!(disabled: true) unless run_with_selenium?
80
- end
81
- end
82
-
83
76
  context 'when visiting an exercise' do
84
77
  scenario 'is redirected to previous path' do
85
78
  visit "/exercises/#{exercise.transparent_id}"
86
79
  fill_in('user_first_name', with: 'first_name')
87
80
 
88
- click_on(button_options)
81
+ click_on(class: 'mu-edit-profile-btn', match: :first)
89
82
  expect(page).to have_text(exercise.description)
90
83
  end
91
84
  end
@@ -95,7 +88,7 @@ feature 'Profile Flow', organization_workspace: :test do
95
88
  visit "/user/edit"
96
89
  fill_in('user_first_name', with: 'first_name')
97
90
 
98
- click_on(button_options)
91
+ click_on(class: 'mu-edit-profile-btn', match: :first)
99
92
  expect(page).to have_text('Your data was updated successfully')
100
93
  expect(page).to have_text('My profile')
101
94
  end
@@ -2,6 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  feature 'User Activity Flow', organization_workspace: :test do
4
4
  let(:user) { create(:user) }
5
+ let(:organization) { Organization.locate!('test') }
6
+
5
7
  before { set_current_user!(user) }
6
8
 
7
9
  let(:fake_stats) { double('stats') }
@@ -30,21 +32,39 @@ feature 'User Activity Flow', organization_workspace: :test do
30
32
  expect(page).to have_text('solved')
31
33
  end
32
34
 
33
- scenario 'displays messages count' do
34
- expect(page).to have_text('12')
35
- expect(page).to have_text('messages')
36
- end
37
-
38
- scenario 'displays validated messages count' do
39
- expect(page).to have_text('6')
40
- expect(page).to have_text('validated')
41
- end
42
-
43
35
  scenario 'displays recent weeks' do
44
36
  expect(page).to have_text 'Week of 2020-10-12'
45
37
  expect(page).to have_text 'Week of 2020-10-05'
46
38
  expect(page).to have_text 'Week of 2020-09-28'
47
39
  end
40
+
41
+ context 'on organization with no forum' do
42
+ scenario 'does not display messages count' do
43
+ expect(page).to_not have_text('messages')
44
+ end
45
+
46
+ scenario 'does not display validated messages count' do
47
+ expect(page).to_not have_text('validated')
48
+ end
49
+ end
50
+
51
+ context 'on organization with forum' do
52
+ before do
53
+ organization.update! forum_enabled: true
54
+ visit activity_user_path
55
+ end
56
+
57
+ scenario 'displays messages count' do
58
+ expect(page).to have_text('12')
59
+ expect(page).to have_text('messages')
60
+ end
61
+
62
+ scenario 'displays validated messages count' do
63
+ expect(page).to have_text('6')
64
+ expect(page).to have_text('validated')
65
+ end
66
+ end
67
+
48
68
  end
49
69
 
50
70
  context 'selecting a specific week' do
@@ -116,5 +116,42 @@ describe WithStudentPathNavigation, organization_workspace: :test do
116
116
 
117
117
  it { expect(next_button(lesson_1)).to include "<a class=\"btn btn-complementary w-100\" role=\"button\" href=\"/chapters/#{chapter_2.friendly_name}\"><span class=\"fa5-text-r\">Next: #{chapter_2.name}</span><i class=\"fas fa-chevron-right\"></i></a>" }
118
118
  end
119
+
120
+ context "when finishing an exam" do
121
+ let!(:organization) { create :organization, exams: [exam] }
122
+
123
+ let(:exam) { create(:exam, exercises: [ exercise ]) }
124
+ let(:exercise) { create(:exercise) }
125
+
126
+ before do
127
+ organization.switch!
128
+ exercise.submit_solution!(current_user).passed!
129
+ end
130
+
131
+ it { expect { next_button(exercise) }.to_not raise_error }
132
+ it { expect(next_button(exercise)).to be_nil }
133
+ end
134
+
135
+ context "when there are manual_evaluation exercises" do
136
+ let(:book) { create :book, topics: [topic] }
137
+ let(:topic) { create :topic, lessons: [lesson_1, lesson_2] }
138
+ let(:lesson_1) { create :lesson, exercises: [create(:exercise, manual_evaluation: true)] }
139
+ let(:lesson_2) { create :lesson, exercises: [regular_exercise] }
140
+ let(:regular_exercise) { create :exercise }
141
+
142
+ before { organization.switch!.reindex_usages! }
143
+
144
+ context 'on organization with prevent_manual_evaluation_content' do
145
+ let(:organization) { create :organization, prevent_manual_evaluation_content: true, book: book }
146
+
147
+ it { expect(next_button(lesson_2)).to be_nil }
148
+ end
149
+
150
+ context 'on organization without prevent_manual_evaluation_content' do
151
+ let(:organization) { create :organization, book: book }
152
+
153
+ it { expect(next_button(lesson_2)).to eq "<a class=\"btn btn-warning w-100\" role=\"button\" href=\"/lessons/#{lesson_1.friendly_name}\"><span class=\"fa5-text-r\">Next pending: #{lesson_1.name}</span><i class=\"fas fa-chevron-right\"></i></a>" }
154
+ end
155
+ end
119
156
  end
120
157
  end