mumuki-laboratory 9.14.1 → 9.18.0

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/codemirror-builder.js +6 -2
  3. data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +3 -2
  4. data/app/assets/javascripts/mumuki_laboratory/application/console.js +7 -1
  5. data/app/assets/javascripts/mumuki_laboratory/application/csrf-token.js +5 -5
  6. data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +9 -13
  7. data/app/assets/javascripts/mumuki_laboratory/application/exercise.js +35 -0
  8. data/app/assets/javascripts/mumuki_laboratory/application/i18n.js +4 -0
  9. data/app/controllers/ajax_controller.rb +1 -1
  10. data/app/controllers/application_controller.rb +2 -2
  11. data/app/controllers/exam_authorization_requests_controller.rb +15 -14
  12. data/app/controllers/exam_registrations_controller.rb +1 -1
  13. data/app/helpers/discussions_helper.rb +4 -1
  14. data/app/helpers/editor_helper.rb +2 -2
  15. data/app/helpers/exams_helper.rb +33 -0
  16. data/app/helpers/exercise_input_helper.rb +0 -4
  17. data/app/helpers/menu_bar_helper.rb +5 -4
  18. data/app/helpers/notifications_helper.rb +1 -1
  19. data/app/helpers/time_helper.rb +12 -0
  20. data/app/helpers/time_zone_helper.rb +5 -1
  21. data/app/helpers/user_discussions_helper.rb +7 -7
  22. data/app/views/book/show.html.erb +4 -2
  23. data/app/views/discussions/_actions.html.erb +1 -0
  24. data/app/views/discussions/_basic_actions.html.erb +20 -0
  25. data/app/views/discussions/_description_message.html.erb +1 -1
  26. data/app/views/discussions/_message.html.erb +6 -2
  27. data/app/views/discussions/new.html.erb +7 -1
  28. data/app/views/discussions/show.html.erb +1 -18
  29. data/app/views/exam_registrations/show.html.erb +1 -1
  30. data/app/views/exercises/_read_only.html.erb +56 -70
  31. data/app/views/exercises/show.html.erb +1 -0
  32. data/app/views/layouts/_discussions_list.html.erb +1 -1
  33. data/app/views/layouts/_messages.html.erb +1 -1
  34. data/app/views/users/_user_form.html.erb +1 -1
  35. data/app/views/users/messages.html.erb +1 -1
  36. data/app/views/users/notifications.html.erb +1 -1
  37. data/lib/mumuki/laboratory/locales/en.yml +6 -0
  38. data/lib/mumuki/laboratory/locales/es-CL.yml +6 -0
  39. data/lib/mumuki/laboratory/locales/es.yml +6 -0
  40. data/lib/mumuki/laboratory/locales/pt.yml +6 -0
  41. data/lib/mumuki/laboratory/version.rb +1 -1
  42. data/spec/controllers/exam_authorization_requests_controller_spec.rb +16 -2
  43. data/spec/dummy/db/schema.rb +2 -1
  44. data/spec/features/not_found_private_flow_spec.rb +1 -1
  45. metadata +113 -109
@@ -45,90 +45,76 @@
45
45
  <div class="accordion-body accordion-collapse collapse show" id="mu-discussion-accordion-body"
46
46
  aria-labelledby="#mu-discussion-accordion-header" data-bs-parent="#mu-discussion-accordion">
47
47
 
48
- <% if should_render_read_only_exercise_tabs?(@discussion) %>
49
- <ul class="nav nav-tabs discussion-tabs" role="tablist">
48
+ <ul class="nav nav-tabs discussion-tabs" role="tablist">
49
+ <li role="presentation">
50
+ <a class="editor-tab nav-link active" data-bs-target="#solution" aria-controls="solution" role="tab" data-bs-toggle="tab">
51
+ <%= t :solution %>
52
+ </a>
53
+ </li>
54
+ <li role="presentation">
55
+ <a class="editor-tab nav-link" data-bs-target="#results" aria-controls="results" role="tab" data-bs-toggle="tab">
56
+ <%= t :results %>
57
+ </a>
58
+ </li>
59
+ <li role="presentation">
60
+ <a class="editor-tab nav-link" data-bs-target="#content" aria-controls="content" role="tab" data-bs-toggle="tab">
61
+ <%= t :description %>
62
+ </a>
63
+ </li>
50
64
 
51
- <% if @discussion.has_submission? %>
52
- <li role="presentation">
53
- <a class="editor-tab nav-link active" data-bs-target="#solution" aria-controls="solution" role="tab" data-bs-toggle="tab">
54
- <%= t :solution %>
55
- </a>
56
- </li>
57
- <li role="presentation">
58
- <a class="editor-tab nav-link" data-bs-target="#results" aria-controls="results" role="tab" data-bs-toggle="tab">
59
- <%= t :results %>
60
- </a>
61
- </li>
62
- <% end %>
63
-
64
- <li role="presentation">
65
- <a class="editor-tab nav-link <%= "active" unless @discussion.has_submission? %>" data-bs-target="#content" aria-controls="content" role="tab" data-bs-toggle="tab">
66
- <%= t :description %>
67
- </a>
68
- </li>
69
-
70
- <% if exercise.extra_visible? %>
71
- <%= extra_code_tab %>
72
- <% end %>
65
+ <% if exercise.extra_visible? %>
66
+ <%= extra_code_tab %>
67
+ <% end %>
73
68
 
74
- <% if exercise.queriable? %>
75
- <%= console_tab %>
76
- <% end %>
77
- </ul>
69
+ <% if exercise.queriable? %>
70
+ <%= console_tab %>
71
+ <% end %>
72
+ </ul>
78
73
 
79
- <div class="tab-content">
80
- <% if @discussion.has_submission? %>
81
- <div role="tabpanel" class="tab-pane active" id="solution">
82
- <div class="mu-tab-body">
83
- <div role="tabpanel" class="tab-pane mu-input-panel fade show active" id="editor">
84
- <div class="mu-read-only-editor">
85
- <%= render_exercise_read_only_editor exercise, @discussion.solution %>
86
- </div>
87
- </div>
88
- </div>
74
+ <div class="tab-content">
75
+ <div role="tabpanel" class="tab-pane mu-input-panel fade show active" id="solution">
76
+ <div class="mu-tab-body">
77
+ <div class="mu-read-only-editor">
78
+ <%= render_exercise_read_only_editor exercise, @discussion.solution %>
89
79
  </div>
80
+ </div>
81
+ </div>
90
82
 
91
- <div role="tabpanel" class="tab-pane" id="results">
92
- <div class="mu-tab-body">
93
- <%= render layout: 'exercise_solutions/contextualization_results_container', locals: { contextualization: @discussion } do %>
94
- <div class="row">
95
- <div class="col-md-12 submission-results">
96
- <%= render partial: 'exercise_solutions/contextualization_results_body',
97
- locals: { contextualization: @discussion, guide_finished_by_solution: false } %>
98
- </div>
99
- </div>
100
- <% end %>
101
- </div>
102
- </div>
103
- <% end %>
104
-
105
- <div role="tabpanel" class="tab-pane <%= 'active' unless @discussion.has_submission? %>" id="content">
106
- <div class="mu-tab-body">
107
- <div class="exercise-assignment">
108
- <%= render partial: 'exercises/exercise_assignment', locals: { exercise: exercise } %>
83
+ <div role="tabpanel" class="tab-pane fade" id="results">
84
+ <div class="mu-tab-body">
85
+ <%= render layout: 'exercise_solutions/contextualization_results_container', locals: { contextualization: @discussion } do %>
86
+ <div class="row">
87
+ <div class="col-md-12 submission-results">
88
+ <%= render partial: 'exercise_solutions/contextualization_results_body',
89
+ locals: { contextualization: @discussion, guide_finished_by_solution: false } %>
90
+ </div>
109
91
  </div>
110
- </div>
92
+ <% end %>
111
93
  </div>
94
+ </div>
112
95
 
113
- <div role="tabpanel" class="tab-pane mu-input-panel fade" id="console">
114
- <div class="mu-overlapped-container">
115
- <div class="console">
116
- </div>
117
- <div class="mu-overlapped">
118
- <%= restart_icon %>
119
- </div>
96
+ <div role="tabpanel" class="tab-pane fade" id="content">
97
+ <div class="mu-tab-body">
98
+ <div class="exercise-assignment">
99
+ <%= render partial: 'exercises/exercise_assignment', locals: { exercise: exercise } %>
120
100
  </div>
121
101
  </div>
102
+ </div>
122
103
 
123
- <div role="tabpanel" class="tab-pane mu-input-panel fade mu-elipsis" id="visible-extra">
124
- <%= @discussion.extra_preview_html %>
104
+ <div role="tabpanel" class="tab-pane mu-input-panel fade" id="console">
105
+ <div class="mu-overlapped-container">
106
+ <div class="console">
107
+ </div>
108
+ <div class="mu-overlapped">
109
+ <%= restart_icon %>
110
+ </div>
125
111
  </div>
126
112
  </div>
127
- <% else %>
128
- <div class="exercise-assignment">
129
- <%= render partial: 'exercises/exercise_assignment', locals: { exercise: exercise } %>
113
+
114
+ <div role="tabpanel" class="tab-pane mu-input-panel fade mu-elipsis" id="visible-extra">
115
+ <%= @discussion.extra_preview_html %>
130
116
  </div>
131
- <% end %>
117
+ </div>
132
118
  </div>
133
119
  </div>
134
120
  </div>
@@ -45,6 +45,7 @@
45
45
  <%= hidden_field_tag "mu-exercise-id", @exercise.id %>
46
46
  <%= hidden_field_tag "mu-exercise-layout", @exercise.layout %>
47
47
  <%= hidden_field_tag "mu-exercise-settings", @exercise.settings.to_json %>
48
+ <%= hidden_field_tag "mu-exercise-read-only", current_access_mode.read_only? %>
48
49
 
49
50
  <div class="d-none" id="processing-template">
50
51
  <div class="bs-callout bs-callout-info">
@@ -26,7 +26,7 @@
26
26
  </span>
27
27
  <span class="discussion-initiator">
28
28
  <strong><%= discussion_user_name discussion.initiator %></strong>
29
- <%= t(:asked_time_since, time: time_ago_in_words(discussion.created_at)) %>
29
+ <%= friendly_time(discussion.created_at, :asked_time_since) %>
30
30
  <span class="discussion-status-icon">
31
31
  <%= discussion_status_fa_icon(discussion) %>
32
32
  </span>
@@ -6,7 +6,7 @@
6
6
  <div class="message">
7
7
  <p> <%= message.content_html %></p>
8
8
  <div class="sender"><%= message.sender unless message.sender == current_user_uid %></div>
9
- <time><%= time_ago_in_words message.created_at %></time>
9
+ <%= friendly_time(message.created_at) %>
10
10
  </div>
11
11
  </li>
12
12
  <% end %>
@@ -31,7 +31,7 @@
31
31
  <span> <strong><%= t :email %>:</strong> <%= @user.email %> </span>
32
32
  </div>
33
33
  <div>
34
- <span> <strong><%= t :programming_since %>:</strong> <%= t(:time_since, time: time_ago_in_words(@user.created_at)) %> </span>
34
+ <span> <strong><%= t :programming_since %>:</strong> <%= friendly_time(@user.created_at, :time_since) %> </span>
35
35
  </div>
36
36
  </div>
37
37
  </div>
@@ -20,7 +20,7 @@
20
20
  <td><%= icon_for_read(message.read?) %></td>
21
21
  <td><%= link_to message.exercise.name, exercise_path(message.exercise.id) %></td>
22
22
  <td><%= mail_to message.sender %></td>
23
- <td><%= time_ago_in_words message.created_at %></td>
23
+ <td><%= friendly_time(message.created_at) %></td>
24
24
  </tr>
25
25
  <% end %>
26
26
  </table>
@@ -38,7 +38,7 @@
38
38
  <%= render partial: "notifications/#{notification.subject}", locals: { notification: notification } %>
39
39
  </td>
40
40
  <td class="col-md-3">
41
- <%= t(:time_since, time: time_ago_in_words(notification.created_at)) %>
41
+ <%= friendly_time(notification.created_at, :time_since) %>
42
42
  </td>
43
43
  </tr>
44
44
  <% end %>
@@ -13,6 +13,7 @@ en:
13
13
  all: All
14
14
  appendix: Appendix
15
15
  appendix_teaser: Do you want to learn more? <a href="%{link}">Check this chapter's appendix</a>"
16
+ approved_by: Validated by %{validator} at %{date}
16
17
  approved_message: Validated by mentor
17
18
  approved_messages:
18
19
  other: validated
@@ -30,6 +31,7 @@ en:
30
31
  authoring: Authoring
31
32
  authoring_note_html: This guide's content was developed by %{authors} under the terms of <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Creative Commons License Share-Alike, 4.0</a>
32
33
  authoring_note_with_collaborators_html: This guide's content was developed by %{authors} and <a href="%{collaborators}" target="_blank">many others</a>, under the terms of <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Creative Commons License Share-Alike, 4.0</a>
34
+ available_time: Available time
33
35
  back_to_mumuki: Back to Mumuki!
34
36
  bibliotheca_ui: Bibliotheca
35
37
  birthdate: Birthdate
@@ -67,9 +69,11 @@ en:
67
69
  continue_practicing: Continue practicing!
68
70
  corollary: To think about
69
71
  correct_answer: The answer is correct!
72
+ course: Course
70
73
  create_submission: Submit
71
74
  created_at: Created at
72
75
  date: Date
76
+ date_and_time: Date and time
73
77
  deleted_by: Deleted by %{deleter}
74
78
  deleted_message_warning: If you repeateadly violate these or other rules, you may be prohibited from accessing the forum or you may suffer more severe consequences, such as being expulsed from the course.
75
79
  deletion_motive:
@@ -272,6 +276,7 @@ en:
272
276
  notifications_will_be_here: Notifications will be here
273
277
  notify_problem_with_exercise: Report a bug
274
278
  office: Office
279
+ only_forum_questions_on_forum: Remember that only exercise-related questions are answered on the forum. For any other kind of inquiries, please check the %{link}.
275
280
  only_landscape_support: Please, rotate your tablet or cellphone to continue practicing
276
281
  opened: Open
277
282
  opened_count: '%{count} opened'
@@ -360,6 +365,7 @@ en:
360
365
  terms_and_conditions_continue_disclaimer: By continuing you agree to %{terms_link}
361
366
  terms_and_conditions_must_be_accepted: You must accept the terms and conditions
362
367
  test_results: Test results
368
+ time_in_minutes: "%{time} minutes"
363
369
  time_since: "%{time} ago"
364
370
  time_left: You have
365
371
  title: Title
@@ -11,6 +11,7 @@ es-CL:
11
11
  and: y
12
12
  appendix: Apéndice
13
13
  appendix_teaser: ¿Quieres saber más? <a href="%{link}">Consulta el apéndice de este capítulo</a>
14
+ approved_by: Validado por %{validator} el %{date}
14
15
  approved_message: Validado por mentorías
15
16
  approved_messages:
16
17
  one: validado
@@ -29,6 +30,7 @@ es-CL:
29
30
  authoring: Autores
30
31
  authoring_note_html: Esta guía fue desarrollada por %{authors} bajo los términos de la <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Licencia Creative Commons Compartir-Igual, 4.0</a>.
31
32
  authoring_note_with_collaborators_html: Esta guía fue desarrollada por %{authors} y <a href="%{collaborators}" target="_blank">muchas personas más</a>, bajo los términos de la <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Licencia Creative Commons Compartir-Igual, 4.0</a>.
33
+ available_time: Tiempo disponible
32
34
  back_to_mumuki: ¡Vuelve a Mumuki!
33
35
  bibliotheca_ui: Biblioteca
34
36
  birthdate: Fecha de nacimiento
@@ -65,11 +67,13 @@ es-CL:
65
67
  continue_lesson: ¡Continúa esta lección!
66
68
  continue_practicing: ¡Sigue aprendiendo!
67
69
  correct_answer: ¡La respuesta es correcta!
70
+ course: Curso
68
71
  create_submission: Enviar
69
72
  created_at: Creado
70
73
  created_exercises: Ejercicios Creados
71
74
  created_guides: Lecciones Creadas
72
75
  date: Fecha
76
+ date_and_time: Fecha y hora
73
77
  deleted_by: Eliminado por %{deleter}
74
78
  deleted_message_warning: Si infringes reiteradamente estas u otras reglas del Espacio de Consultas, se te puede prohibir el acceso al mismo o podrás sufrir consecuencias más severas, como la expulsión del curso.
75
79
  deletion_motive:
@@ -280,6 +284,7 @@ es-CL:
280
284
  notifications_will_be_here: Tus notificaciones aparecerán aquí
281
285
  notify_problem_with_exercise: Reporta un bug
282
286
  office: Secretaría
287
+ only_forum_questions_on_forum: Recuerda que en el espacio de consultas se responden únicamente dudas relacionadas a los ejercicios. Para cualquier otro tipo de consulta, revisa la %{link}.
283
288
  only_landscape_support: Por favor, rota tu tablet o celular para realizar ejercicios
284
289
  opened: Abierta
285
290
  opened_count:
@@ -374,6 +379,7 @@ es-CL:
374
379
  terms_and_conditions_continue_disclaimer: Al continuar aceptas los %{terms_link}
375
380
  terms_and_conditions_must_be_accepted: Tienes que aceptar los términos y condiciones
376
381
  test_results: Resultados de las pruebas
382
+ time_in_minutes: "%{time} minutos"
377
383
  time_since: "hace %{time}"
378
384
  time_left: Te quedan
379
385
  title: Título
@@ -14,6 +14,7 @@ es:
14
14
  and: y
15
15
  appendix: Apéndice
16
16
  appendix_teaser: ¿Querés saber más? <a href="%{link}">Consultá el apéndice de este capítulo</a>
17
+ approved_by: Validado por %{validator} el %{date}
17
18
  approved_message: Validado por mentorías
18
19
  approved_messages:
19
20
  one: validado
@@ -32,6 +33,7 @@ es:
32
33
  authoring: Autores
33
34
  authoring_note_html: Esta guía fue desarrollada por %{authors} bajo los términos de la <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Licencia Creative Commons Compartir-Igual, 4.0</a>.
34
35
  authoring_note_with_collaborators_html: Esta guía fue desarrollada por %{authors} y <a href="%{collaborators}" target="_blank">muchas personas más</a>, bajo los términos de la <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Licencia Creative Commons Compartir-Igual, 4.0</a>.
36
+ available_time: Tiempo disponible
35
37
  back_to_mumuki: ¡Volvé a Mumuki!
36
38
  bibliotheca_ui: Biblioteca
37
39
  birthdate: Fecha de nacimiento
@@ -68,6 +70,7 @@ es:
68
70
  continue_lesson: ¡Continuá esta lección!
69
71
  continue_practicing: ¡Seguí aprendiendo!
70
72
  correct_answer: ¡La respuesta es correcta!
73
+ course: Curso
71
74
  create_submission: Enviar
72
75
  created_at: Creado
73
76
  created_at_asc: Antiguas
@@ -75,6 +78,7 @@ es:
75
78
  created_exercises: Ejercicios Creados
76
79
  created_guides: Lecciones Creadas
77
80
  date: Fecha
81
+ date_and_time: Fecha y hora
78
82
  deleted_by: Eliminado por %{deleter}
79
83
  deleted_message_warning: Si infringís reiteradamente estas u otras reglas del Espacio de Consultas, se te puede prohibir el acceso al mismo o podrás sufrir consecuencias más severas, como la expulsión del curso.
80
84
  deletion_motive:
@@ -289,6 +293,7 @@ es:
289
293
  notifications_will_be_here: Tus notificaciones aparecerán aquí
290
294
  notify_problem_with_exercise: Reportá un bug
291
295
  office: Secretaría
296
+ only_forum_questions_on_forum: Recordá que en el espacio de consultas se responden únicamente dudas relacionadas a los ejercicios. Para cualquier otro tipo de consulta, revisá la %{link}.
292
297
  only_landscape_support: Por favor, rotá tu tablet o celular para realizar ejercicios
293
298
  opened: Abierta
294
299
  opened_count:
@@ -388,6 +393,7 @@ es:
388
393
  terms_and_conditions_continue_disclaimer: Al continuar estás aceptando los %{terms_link}
389
394
  terms_and_conditions_must_be_accepted: Tenés que aceptar los términos y condiciones
390
395
  test_results: Resultados de las pruebas
396
+ time_in_minutes: "%{time} minutos"
391
397
  time_since: "hace %{time}"
392
398
  time_left: Te quedan
393
399
  title: Título
@@ -13,6 +13,7 @@ pt:
13
13
  and: e
14
14
  appendix: Apêndice
15
15
  appendix_teaser: Você quer saber mais? <a href="%{link}"> Consulte o apêndice deste capítulo </a>
16
+ approved_by: Validado pelo %{validator} em %{date}
16
17
  approved_message: Validado pelo mentor
17
18
  approved_messages:
18
19
  one: validado
@@ -31,6 +32,7 @@ pt:
31
32
  authoring: Autores
32
33
  authoring_note_html: 'Este guia foi desenvolvido por %{authors} nos termos do <a href = "https://creativecommons.org/licenses/by-sa/4.0/" target="_blank"> Creative Commons License Share-Equal, 4.0 </a>.'
33
34
  authoring_note_with_collaborators_html: 'Este guia foi desenvolvido por %{authors} e <a href="%{collaborators}" target="_blank">muitas outras pessoas </a>, nos termos do <a href = "https://creativecommons.org/licenses/by-sa/4.0/" target="_blank"> Creative Commons License Share-Equal, 4.0 </a>.'
35
+ available_time: Tempo disponível
34
36
  back_to_mumuki: Voltei para Mumuki!
35
37
  bibliotheca_ui: Biblioteca
36
38
  birthdate: Fecha de nacimiento
@@ -64,6 +66,7 @@ pt:
64
66
  continue_lesson: Continue esta lição!
65
67
  continue_practicing: Continue aprendendo!
66
68
  correct_answer: A resposta está correta!
69
+ course: Curso
67
70
  create_submission: Enviar
68
71
  created_at: Criado
69
72
  created_at_asc: Antigo
@@ -71,6 +74,7 @@ pt:
71
74
  created_exercises: Exercícios criados
72
75
  created_guides: Lições criadas
73
76
  date: Data
77
+ date_and_time: Data e hora
74
78
  deleted_by: Removido pelo
75
79
  deleted_message_warning: Se você violar repetidamente essas ou outras regras da Área de Consulta, seu acesso a ela pode ser proibido ou você pode sofrer consequências mais graves, como a expulsão do curso.
76
80
  deletion_motive:
@@ -280,6 +284,7 @@ pt:
280
284
  notifications_will_be_here: Suas notificações aparecerão aqui
281
285
  notify_problem_with_exercise: Relatar um erro
282
286
  office: Secretariado
287
+ only_forum_questions_on_forum: Lembre-se que apenas as dúvidas relacionadas aos exercícios são respondidas no espaço de consulta. Para qualquer outro tipo de consulta, reveja a %{link}.
283
288
  only_landscape_support: Por favor, gire seu tablet ou celular para realizar exercícios
284
289
  opened: Aberto
285
290
  opened_count: '%{count} aberto'
@@ -373,6 +378,7 @@ pt:
373
378
  terms_and_conditions_continue_disclaimer: Ao continuar, você concorda %{terms_link}
374
379
  terms_and_conditions_must_be_accepted: Você deve aceitar os Termos e Condições
375
380
  test_results: Resultados do teste
381
+ time_in_minutes: "%{time} minutos"
376
382
  time_since: "há %{time}"
377
383
  time_left: Te deixam
378
384
  title: Título
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Laboratory
3
- VERSION = '9.14.1'
3
+ VERSION = '9.18.0'
4
4
  end
5
5
  end
@@ -3,7 +3,9 @@ require 'spec_helper'
3
3
  describe ExamAuthorizationRequestsController, type: :controller, organization_workspace: :test do
4
4
  let(:user) { create(:user) }
5
5
  let(:exam) { create(:exam) }
6
- let(:exam_registration) { create(:exam_registration, exams: [exam]) }
6
+ let(:exam_id) { exam.id }
7
+ let(:organization) { Organization.current }
8
+ let(:exam_registration) { create(:exam_registration, exams: [exam], organization: organization) }
7
9
 
8
10
  before { set_current_user! user }
9
11
 
@@ -12,12 +14,24 @@ describe ExamAuthorizationRequestsController, type: :controller, organization_wo
12
14
 
13
15
  def do_post
14
16
  post :create, params: {
15
- exam_authorization_request: { exam_id: exam.id, exam_registration_id: exam_registration.id }
17
+ exam_authorization_request: { exam_id: exam_id, exam_registration_id: exam_registration.id }
16
18
  }
17
19
  end
18
20
 
19
21
  before { do_post }
20
22
 
23
+ describe 'called once in wrong organization' do
24
+ let(:organization) { create(:organization, name: 'other') }
25
+ it { expect(response.status).to eq 404 }
26
+ it { expect(exam_registration.authorization_requests.size).to be 0 }
27
+ end
28
+
29
+ describe 'called once with wrong exam' do
30
+ let(:exam_id) { create(:exam).id }
31
+ it { expect(response.status).to eq 404 }
32
+ it { expect(exam_registration.authorization_requests.size).to be 0 }
33
+ end
34
+
21
35
  describe 'called once' do
22
36
  it { expect(response.status).to eq 302 }
23
37
  it { expect(exam_registration.authorization_requests.size).to be 1 }
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20210803175124) do
13
+ ActiveRecord::Schema.define(version: 20210929223144) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
@@ -194,6 +194,7 @@ ActiveRecord::Schema.define(version: 20210803175124) do
194
194
  t.datetime "created_at", null: false
195
195
  t.datetime "updated_at", null: false
196
196
  t.boolean "processed", default: false
197
+ t.integer "authorization_requests_limit"
197
198
  t.index ["organization_id"], name: "index_exam_registrations_on_organization_id"
198
199
  end
199
200
 
@@ -30,7 +30,7 @@ feature 'not found private on app', organization_workspace: :base do
30
30
  expect(page.text).to json_eq errors: [
31
31
  'The operation on organization base' +
32
32
  ' was forbidden to user foo+1@bar.com' +
33
- ' with permissions !student:central/*;teacher:;headmaster:;janitor:;admin:;owner:;ex_student:']
33
+ ' with permissions !student:central/*;teacher:;headmaster:;janitor:;admin:;owner:']
34
34
  end
35
35
 
36
36
  scenario 'api with authentication', :json_eq_error do