mumuki-laboratory 9.10.0 → 9.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/app/assets/javascripts/mumuki_laboratory/application/bridge.js +15 -9
- data/app/assets/javascripts/mumuki_laboratory/application/confirmation.js +10 -8
- data/app/assets/javascripts/mumuki_laboratory/application/editors.js +5 -3
- data/app/assets/javascripts/mumuki_laboratory/application/progress.js +4 -4
- data/app/assets/javascripts/mumuki_laboratory/application/results-renderer.js +12 -1
- data/app/assets/javascripts/mumuki_laboratory/application/submissions-store.js +8 -2
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_dropdown.scss +11 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_faqs.scss +1 -1
- data/app/controllers/application_controller.rb +8 -4
- data/app/controllers/book_controller.rb +6 -0
- data/app/controllers/chapters_controller.rb +9 -0
- data/app/controllers/discussions_controller.rb +9 -0
- data/app/controllers/exercises_controller.rb +5 -0
- data/app/controllers/faqs_controller.rb +4 -0
- data/app/controllers/lessons_controller.rb +9 -0
- data/app/controllers/users_controller.rb +37 -0
- data/app/helpers/application_helper.rb +2 -2
- data/app/helpers/concerns/with_student_path_navigation.rb +1 -1
- data/app/helpers/content_view_helper.rb +8 -0
- data/app/helpers/discussions_helper.rb +1 -1
- data/app/helpers/icons_helper.rb +1 -1
- data/app/helpers/links_helper.rb +5 -1
- data/app/helpers/menu_bar_helper.rb +8 -5
- data/app/helpers/notifications_helper.rb +13 -0
- data/app/helpers/overlapped_buttons_helper.rb +2 -1
- data/app/helpers/time_zone_helper.rb +5 -0
- data/app/helpers/user_menu_helper.rb +4 -0
- data/app/mailers/user_mailer.rb +11 -1
- data/app/views/book/show.html.erb +16 -7
- data/app/views/chapters/show.html.erb +1 -0
- data/app/views/discussions/_new_message.html.erb +1 -1
- data/app/views/discussions/show.html.erb +5 -5
- data/app/views/exercise_solutions/_results.html.erb +1 -1
- data/app/views/guides/_guide.html.erb +2 -2
- data/app/views/layouts/_progress_bar.html.erb +1 -0
- data/app/views/layouts/_progress_listing.html.erb +1 -0
- data/app/views/layouts/_user_menu.html.erb +1 -0
- data/app/views/layouts/application.html.erb +4 -0
- data/app/views/layouts/exercise_inputs/forms/_kids_form.html.erb +1 -1
- data/app/views/layouts/exercise_inputs/forms/_problem_form.html.erb +6 -2
- data/app/views/layouts/exercise_inputs/read_only_editors/_code.html.erb +1 -1
- data/app/views/layouts/exercise_inputs/read_only_editors/_hidden.html.erb +0 -0
- data/app/views/layouts/exercise_inputs/read_only_editors/_multiple_files.html.erb +4 -4
- data/app/views/layouts/exercise_inputs/read_only_editors/_upload.html.erb +0 -0
- data/app/views/layouts/mailer.html.erb +7 -1
- data/app/views/notifications/_custom.html.erb +1 -0
- data/app/views/notifications/_dropdown.html.erb +2 -2
- data/app/views/notifications/_exam_authorization_request_updated.html.erb +2 -0
- data/app/views/notifications/_exam_registration.html.erb +2 -1
- data/app/views/notifications/previews/_custom.html.erb +1 -0
- data/app/views/notifications/previews/_discussion.html.erb +2 -0
- data/app/views/notifications/previews/_exam_authorization_request_updated.html.erb +2 -0
- data/app/views/notifications/previews/_exam_registration.html.erb +2 -0
- data/app/views/notifications/previews/_message.html.erb +2 -0
- data/app/views/user_mailer/1st_reminder.html.erb +7 -349
- data/app/views/user_mailer/1st_reminder.text.erb +0 -4
- data/app/views/user_mailer/2nd_reminder.html.erb +7 -349
- data/app/views/user_mailer/2nd_reminder.text.erb +0 -4
- data/app/views/user_mailer/3rd_reminder.html.erb +7 -349
- data/app/views/user_mailer/3rd_reminder.text.erb +0 -4
- data/app/views/user_mailer/_mail_template.erb +336 -0
- data/app/views/user_mailer/certificate.html.erb +7 -335
- data/app/views/user_mailer/certificate.text.erb +0 -3
- data/app/views/user_mailer/no_submissions_reminder.html.erb +7 -349
- data/app/views/user_mailer/no_submissions_reminder.text.erb +0 -4
- data/app/views/user_mailer/notification.html.erb +1 -0
- data/app/views/user_mailer/notification.text.erb +6 -0
- data/app/views/user_mailer/notifications/_custom.html.erb +11 -0
- data/app/views/user_mailer/notifications/_exam_authorization_request_updated.html.erb +1 -0
- data/app/views/user_mailer/notifications/_exam_registration.html.erb +7 -0
- data/app/views/user_mailer/notifications/exam_authorization_request_updated/_approved.html.erb +7 -0
- data/app/views/user_mailer/notifications/exam_authorization_request_updated/_rejected.html.erb +7 -0
- data/app/views/users/manage_notifications.html.erb +26 -0
- data/app/views/users/notifications.html.erb +54 -0
- data/config/routes.rb +4 -0
- data/lib/mumuki/laboratory.rb +1 -0
- data/lib/mumuki/laboratory/controllers.rb +1 -0
- data/lib/mumuki/laboratory/controllers/authorization.rb +5 -1
- data/lib/mumuki/laboratory/controllers/notifications.rb +2 -2
- data/lib/mumuki/laboratory/controllers/validate_access_mode.rb +15 -0
- data/lib/mumuki/laboratory/locales/en.yml +35 -1
- data/lib/mumuki/laboratory/locales/es-CL.yml +35 -1
- data/lib/mumuki/laboratory/locales/es.yml +36 -2
- data/lib/mumuki/laboratory/locales/pt.yml +35 -1
- data/lib/mumuki/laboratory/mailers/message_delivery.rb +15 -0
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/controllers/users_controller_spec.rb +48 -0
- data/spec/dummy/db/schema.rb +7 -1
- data/spec/features/menu_bar_spec.rb +3 -2
- data/spec/features/not_found_private_flow_spec.rb +1 -1
- data/spec/features/notifications_flow_spec.rb +2 -1
- data/spec/features/read_only_flow_spec.rb +920 -0
- data/spec/javascripts/editors-spec.js +21 -3
- data/spec/javascripts/submissions-store-spec.js +11 -0
- data/spec/mailers/previews/user_mailer_preview.rb +87 -1
- metadata +35 -19
- data/app/views/notifications/_discussion.html.erb +0 -1
- data/app/views/notifications/_exam_authorization_request.html.erb +0 -1
- data/app/views/notifications/_message.html.erb +0 -1
@@ -37,6 +37,8 @@ pt:
|
|
37
37
|
blocked_forum_explanation: Você está no meio de um exame agora?
|
38
38
|
cancel: Cancelar
|
39
39
|
certificate: Certificado
|
40
|
+
certificate_available: Seu certificado já está disponível
|
41
|
+
certificate_download: Baixe-o do anexo deste e-mail ou visualize-o em seu perfil Mumuki.
|
40
42
|
certificates: Certificados
|
41
43
|
certificates_will_be_here: Seus certificados nesta organização aparecerão aqui
|
42
44
|
certificate_verified_legend: "A conta de <strong>% {full_name} </strong> foi verificada. Mumuki certifica a conclusão com sucesso de <strong>% {description} </strong>."
|
@@ -54,6 +56,7 @@ pt:
|
|
54
56
|
confirm: Confirme
|
55
57
|
confirm_reset: Você está prestes a reiniciar seu exercício. Você quer continuar?
|
56
58
|
confirm_restart: Você está prestes a apagar o seu progresso neste guia. Você quer continuar?
|
59
|
+
congratulations: Parabéns!
|
57
60
|
console: Consola
|
58
61
|
contact_administrator: Se você acha que é um erro, entre em contato com %{link}
|
59
62
|
content: Conteúdo
|
@@ -89,7 +92,7 @@ pt:
|
|
89
92
|
disabled_explanation: Você está tentando acessar um recurso que foi desativado ou removido permanentemente
|
90
93
|
disabled_organization_explanation: Este curso terminou
|
91
94
|
discussion_description_placeholder: Você pode adicionar mais informações sobre sua dúvida
|
92
|
-
new_discussion_message: Nova
|
95
|
+
new_discussion_message: Nova resposta em %{title}
|
93
96
|
discussion_created_by: Criada por
|
94
97
|
discussion_updated: Consulta actualizada
|
95
98
|
discussions: Consultas
|
@@ -167,6 +170,7 @@ pt:
|
|
167
170
|
home: Home
|
168
171
|
hour: hora
|
169
172
|
hours: horas
|
173
|
+
i_want_emails_of: Quero receber e-mails de
|
170
174
|
important_info: Informação importante
|
171
175
|
initial_state: Tabuleiro inicial
|
172
176
|
insert_file_name: Insira um nome de arquivo
|
@@ -193,7 +197,28 @@ pt:
|
|
193
197
|
loading: Carregando
|
194
198
|
load_solution_into_console: Carregue a solução no console
|
195
199
|
locked_content: 'Este conteúdo será desbloqueado quando você terminar os capítulos anteriores'
|
200
|
+
mailer:
|
201
|
+
title:
|
202
|
+
exam_authorization_request_updated: Você tem alterações no registro do seu exame
|
203
|
+
exam_authorization_request_rejected: Inscrição rejeitada
|
204
|
+
exam_registration: Abertura de inscrições
|
205
|
+
custom: Você tem uma nova notificação!
|
206
|
+
subtitle:
|
207
|
+
exam_authorization_request_approved: Seu pedido de inscrição para o exame foi aprovado.
|
208
|
+
exam_authorization_request_rejected: Sua inscrição para o exame foi rejeitada porque os requisitos não foram atendidos.
|
209
|
+
exam_registration: Agora você pode se inscrever para o exame!
|
210
|
+
text:
|
211
|
+
exam_authorization_request_approved: Você poderá fazer o exame em %{exam_start_date} ao entrar na plataforma. Êxitos!
|
212
|
+
exam_authorization_request_rejected: Não te desanimes! Você fez um grande esforço e esperamos que continue aprendendo programação.
|
213
|
+
exam_registration: Você tem tempo para se registrar até o exam_registration_deadline. Para que seu registro seja aceito, você deve atender aos requisitos.
|
214
|
+
button:
|
215
|
+
exam_registration: Assinar o exame
|
216
|
+
exam_authorization_request_approved: Vá para a plataforma
|
217
|
+
exam_authorization_request_rejected: Meus exames
|
218
|
+
custom: Minhas notificações
|
196
219
|
male: Masculino
|
220
|
+
manage_notification_subscriptions: Gerenciar suas notificações
|
221
|
+
manage_notifications: Gerenciar notificações
|
197
222
|
manual_evaluation_pending: Obrigado por enviar sua solução! Seus professores irão corrigi-lo em breve
|
198
223
|
medal: Medalha
|
199
224
|
message: Mensagem
|
@@ -218,6 +243,7 @@ pt:
|
|
218
243
|
you_wont_confirmation: Você não vai cuidar dessa consulta.
|
219
244
|
my_account: Minha conta
|
220
245
|
my_doubts: Minhas duvidas
|
246
|
+
my_notifications: Minhas notificações
|
221
247
|
my_profile: Meu perfil
|
222
248
|
name: Nome
|
223
249
|
navigation_continue: "Próximo %{kind}: %{sibling}"
|
@@ -246,7 +272,12 @@ pt:
|
|
246
272
|
not_found: A página que você pesquisou não existe!
|
247
273
|
not_found_explanation: Olhe se você escreveu o endereço corretamente.
|
248
274
|
not_in_any_organizations: Parece que você ainda não está em nenhuma organização!
|
275
|
+
notification_subject:
|
276
|
+
custom: Anúncios gerais
|
277
|
+
exam_authorization_request_updated: Mudanças no registro do exame
|
278
|
+
exam_registration: Inscrição para exames qualificados
|
249
279
|
notifications: Notificações
|
280
|
+
notifications_will_be_here: Suas notificações aparecerão aqui
|
250
281
|
notify_problem_with_exercise: Relatar um erro
|
251
282
|
office: Secretariado
|
252
283
|
only_landscape_support: Por favor, gire seu tablet ou celular para realizar exercícios
|
@@ -267,6 +298,7 @@ pt:
|
|
267
298
|
permissions: Permissões
|
268
299
|
please_fill_profile_data: Preencha suas informações pessoais para continuar!
|
269
300
|
please_validate: Você está prestes a entrar no curso. Para oferecer uma experiência melhor, valide que seus dados abaixo sejam reais e corretos.
|
301
|
+
preferences_updated_successfully: Suas preferências foram atualizadas com sucesso
|
270
302
|
preview: Vista prévia
|
271
303
|
preview_error: A visualizaçao não pode ser mostrada. Verifique sua conexão com a internet ou tente com uma mensagem mais curta.
|
272
304
|
previous_exercise: Anterior
|
@@ -347,6 +379,7 @@ pt:
|
|
347
379
|
to_opened: Reabrir
|
348
380
|
to_pending_review: Marcar como resolvida
|
349
381
|
to_solved: Marcar como resolvida
|
382
|
+
toggle_read: "Marcar como lido / não lido"
|
350
383
|
unauthorized_explanation: Opa! Isso é o que é conhecido como %{error}, ou seja, você não fez logon.
|
351
384
|
total: Total
|
352
385
|
uncategorized: Não classificado
|
@@ -369,5 +402,6 @@ pt:
|
|
369
402
|
wrong_answer: A resposta não é correta
|
370
403
|
years: anos
|
371
404
|
you_earned: Você ganhou
|
405
|
+
you_have_a_new_notification: Você tem uma nova notificação!
|
372
406
|
you_must_sign_in_before_submitting: Você deve fazer o login antes de começar a enviar suas soluções
|
373
407
|
your_new_organization: sua nova organização
|
@@ -19,4 +19,52 @@ describe UsersController, type: :controller, organization_workspace: :test do
|
|
19
19
|
it { expect(User.last.verified_first_name).to be_nil }
|
20
20
|
end
|
21
21
|
|
22
|
+
context 'notifications' do
|
23
|
+
context 'get' do
|
24
|
+
context 'when logged in' do
|
25
|
+
before { set_current_user! user }
|
26
|
+
before { get :notifications }
|
27
|
+
|
28
|
+
it { expect(response.status).to eq 200 }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when not logged in' do
|
32
|
+
before { get :notifications }
|
33
|
+
|
34
|
+
it { expect(response.status).to eq 302 }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'toggle_read' do
|
39
|
+
before { set_current_user! user }
|
40
|
+
before { post :toggle_read, params: { id: notification.id } }
|
41
|
+
|
42
|
+
context 'on toggling own notification read' do
|
43
|
+
let(:notification) { create :notification, user: user }
|
44
|
+
|
45
|
+
it { expect(response.status).to eq 302 }
|
46
|
+
it { expect(notification.reload.read?).to be true }
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'on toggling someone else\'s notification read' do
|
50
|
+
let(:notification) { create :notification, user: create(:user) }
|
51
|
+
|
52
|
+
it { expect(response.status).to eq 404 }
|
53
|
+
it { expect(notification.reload.read?).to be false }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'notifications/manage' do
|
58
|
+
context 'post' do
|
59
|
+
let(:user) { create :user, ignored_notifications: [] }
|
60
|
+
|
61
|
+
before { set_current_user! user }
|
62
|
+
before { post :manage_notifications, params: { notifications: {'custom' => 1, 'exam_registrations' => 0 } } }
|
63
|
+
|
64
|
+
it { expect(response.status).to eq 302 }
|
65
|
+
it { expect(flash.notice).to eq 'Preferences updated successfully' }
|
66
|
+
it { expect(user.reload.ignored_notifications).to eq ['exam_registrations'] }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
22
70
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -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:
|
13
|
+
ActiveRecord::Schema.define(version: 20210803175124) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
@@ -193,6 +193,7 @@ ActiveRecord::Schema.define(version: 20210707143002) do
|
|
193
193
|
t.bigint "organization_id"
|
194
194
|
t.datetime "created_at", null: false
|
195
195
|
t.datetime "updated_at", null: false
|
196
|
+
t.boolean "processed", default: false
|
196
197
|
t.index ["organization_id"], name: "index_exam_registrations_on_organization_id"
|
197
198
|
end
|
198
199
|
|
@@ -399,6 +400,10 @@ ActiveRecord::Schema.define(version: 20210707143002) do
|
|
399
400
|
t.bigint "organization_id"
|
400
401
|
t.datetime "created_at", null: false
|
401
402
|
t.datetime "updated_at", null: false
|
403
|
+
t.integer "subject"
|
404
|
+
t.text "custom_title"
|
405
|
+
t.text "custom_content_plain_text"
|
406
|
+
t.text "custom_content_html"
|
402
407
|
t.index ["organization_id"], name: "index_notifications_on_organization_id"
|
403
408
|
t.index ["target_type", "target_id"], name: "index_notifications_on_target_type_and_target_id"
|
404
409
|
t.index ["user_id"], name: "index_notifications_on_user_id"
|
@@ -529,6 +534,7 @@ ActiveRecord::Schema.define(version: 20210707143002) do
|
|
529
534
|
t.boolean "uppercase_mode"
|
530
535
|
t.string "delete_account_token"
|
531
536
|
t.datetime "delete_account_token_expiration_date"
|
537
|
+
t.text "ignored_notifications"
|
532
538
|
t.index ["avatar_type", "avatar_id"], name: "index_users_on_avatar_type_and_avatar_id"
|
533
539
|
t.index ["disabled_at"], name: "index_users_on_disabled_at"
|
534
540
|
t.index ["last_organization_id"], name: "index_users_on_last_organization_id"
|
@@ -50,11 +50,11 @@ feature 'menu bar' do
|
|
50
50
|
let(:admin) { create(:user, permissions: {student: 'private/*', admin: 'private/*'}) }
|
51
51
|
let(:owner) { create(:user, permissions: {student: 'private/*', owner: 'private/*'}) }
|
52
52
|
|
53
|
-
scenario 'visitor should only see
|
53
|
+
scenario 'visitor should only see sing out' do
|
54
54
|
set_current_user! visitor
|
55
55
|
|
56
56
|
visit '/'
|
57
|
-
expect(page).
|
57
|
+
expect(page).not_to have_text('My account')
|
58
58
|
expect(page).not_to have_text('Classroom')
|
59
59
|
expect(page).not_to have_text('Bibliotheca')
|
60
60
|
expect(page).not_to have_text('Solve other\'s doubts')
|
@@ -93,6 +93,7 @@ feature 'menu bar' do
|
|
93
93
|
before { Organization.current.update! faqs: "Some faqs" }
|
94
94
|
|
95
95
|
scenario 'should see FAQs link' do
|
96
|
+
set_current_user! student
|
96
97
|
visit '/'
|
97
98
|
|
98
99
|
expect(page).to have_text('FAQs')
|
@@ -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:']
|
33
|
+
' with permissions !student:central/*;teacher:;headmaster:;janitor:;admin:;owner:;ex_student:']
|
34
34
|
end
|
35
35
|
|
36
36
|
scenario 'api with authentication', :json_eq_error do
|
@@ -22,7 +22,8 @@ feature 'Notifications Flow', organization_workspace: :test do
|
|
22
22
|
let(:exam_authorization_request) { create(:exam_authorization_request, exam_registration: exam_registration, user: user) }
|
23
23
|
|
24
24
|
let!(:notifications) do
|
25
|
-
|
25
|
+
create(:notification, user: user, target: exam_registration, subject: :exam_registration )
|
26
|
+
create(:notification, user: user, target: exam_authorization_request, subject: :exam_authorization_request_updated )
|
26
27
|
end
|
27
28
|
|
28
29
|
before { visit '/' }
|
@@ -0,0 +1,920 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Read Only Flow' do
|
4
|
+
|
5
|
+
let(:organization) { create :organization, name: 'private', forum_enabled: true, public: false, faqs: 'FAQs', book: book }
|
6
|
+
let(:user) { create :user }
|
7
|
+
let(:other_user) { create :user }
|
8
|
+
|
9
|
+
let(:slug) { Mumukit::Auth::Slug.join_s organization.name, 'foo' }
|
10
|
+
|
11
|
+
let(:exercise111) { create :exercise, name: 'Exercise 111' }
|
12
|
+
let(:exercise112) { create :exercise, name: 'Exercise 112' }
|
13
|
+
let(:exercise121) { create :exercise, name: 'Exercise 121' }
|
14
|
+
let(:exercise122) { create :exercise, name: 'Exercise 122' }
|
15
|
+
let(:exercise211) { create :exercise, name: 'Exercise 211' }
|
16
|
+
let(:exercise212) { create :exercise, name: 'Exercise 212' }
|
17
|
+
let(:lesson11) { create :lesson, name: 'Lesson 11', exercises: [exercise111, exercise112] }
|
18
|
+
let(:lesson12) { create :lesson, name: 'Lesson 12', exercises: [exercise121, exercise122] }
|
19
|
+
let(:lesson21) { create :lesson, name: 'Lesson 21', exercises: [exercise211, exercise212] }
|
20
|
+
let(:chapter1) { create :chapter, name: 'Chapter 1', lessons: [lesson11, lesson12] }
|
21
|
+
let(:chapter2) { create :chapter, name: 'Chapter 2', lessons: [lesson21] }
|
22
|
+
let(:book) { create :book, chapters: [chapter1, chapter2] }
|
23
|
+
|
24
|
+
let(:assignment111) { build :assignment, submitter: user, organization: organization, exercise: exercise111, status: :failed }
|
25
|
+
let(:discussion111) { build :discussion, initiator: assignment111.user, item: assignment111.exercise, organization: assignment111.organization }
|
26
|
+
|
27
|
+
let(:assignment112) { build :assignment, submitter: other_user, organization: organization, exercise: exercise112, status: :failed }
|
28
|
+
let(:discussion112) { build :discussion, initiator: assignment112.user, item: assignment112.exercise, organization: assignment112.organization }
|
29
|
+
|
30
|
+
before { set_subdomain_host! organization.name }
|
31
|
+
|
32
|
+
before { set_current_user! user }
|
33
|
+
|
34
|
+
before { assignment111.save! }
|
35
|
+
before { discussion111.save! }
|
36
|
+
before { discussion112.save! }
|
37
|
+
|
38
|
+
context 'in private organization' do
|
39
|
+
context 'when organization is enabled' do
|
40
|
+
context 'and user is teacher of organization' do
|
41
|
+
before { user.update! permissions: { teacher: slug } }
|
42
|
+
scenario 'avatar dorpdown' do
|
43
|
+
visit "/"
|
44
|
+
find('#profileDropdown').click
|
45
|
+
expect(page).to have_text('My account')
|
46
|
+
expect(page).to have_text('FAQs')
|
47
|
+
expect(page).to have_text('Classroom')
|
48
|
+
expect(page).to have_text('Solve other\'s doubts')
|
49
|
+
expect(page).to have_text('My doubts')
|
50
|
+
expect(page).not_to have_text('Bibliotheca')
|
51
|
+
expect(page).to have_text('Sign Out')
|
52
|
+
end
|
53
|
+
scenario 'show book' do
|
54
|
+
visit "/"
|
55
|
+
expect(page).to have_text('Chapter 1')
|
56
|
+
expect(page).to have_text('Chapter 2')
|
57
|
+
expect(page).to have_text('Practicing!')
|
58
|
+
end
|
59
|
+
scenario 'show chapter' do
|
60
|
+
visit "/chapters/#{chapter1.id}"
|
61
|
+
expect(page).to have_text('Lesson 11')
|
62
|
+
expect(page).to have_text('Lesson 12')
|
63
|
+
expect(page).to have_text('Exercise 111')
|
64
|
+
expect(page).to have_text('Exercise 112')
|
65
|
+
expect(page).to have_text('Exercise 121')
|
66
|
+
expect(page).to have_text('Exercise 122')
|
67
|
+
end
|
68
|
+
scenario 'show lesson' do
|
69
|
+
visit "/lessons/#{lesson11.id}"
|
70
|
+
expect(page).to have_text('Lesson 11')
|
71
|
+
expect(page).to have_text('Exercise 111')
|
72
|
+
expect(page).to have_text('Exercise 112')
|
73
|
+
expect(page).to have_text('Continue this lesson!')
|
74
|
+
end
|
75
|
+
scenario 'show exercise 111' do
|
76
|
+
visit "/exercises/#{exercise111.id}"
|
77
|
+
expect(page).to have_text('Exercise 111')
|
78
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
79
|
+
expect(page).to have_text('Solve your doubts')
|
80
|
+
end
|
81
|
+
scenario 'show exercise 112' do
|
82
|
+
visit "/exercises/#{exercise112.id}"
|
83
|
+
expect(page).to have_text('Exercise 112')
|
84
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
85
|
+
expect(page).not_to have_text('Solve your doubts')
|
86
|
+
end
|
87
|
+
scenario 'show profile' do
|
88
|
+
visit "/user"
|
89
|
+
expect(page).to have_text('My profile')
|
90
|
+
end
|
91
|
+
scenario 'show faqs' do
|
92
|
+
visit "/faqs"
|
93
|
+
expect(page).to have_text('FAQs')
|
94
|
+
end
|
95
|
+
scenario 'show discussion' do
|
96
|
+
visit "/discussions"
|
97
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
98
|
+
end
|
99
|
+
scenario 'show discussion in existent exercise' do
|
100
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
101
|
+
expect(page).to have_text('Exercise 111')
|
102
|
+
expect(page).to have_selector(:link_or_button, 'Comment')
|
103
|
+
end
|
104
|
+
scenario 'show discussion in existent exercise' do
|
105
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
106
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
107
|
+
end
|
108
|
+
scenario 'new discussion' do
|
109
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
110
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'and user is student of organization' do
|
115
|
+
before { user.update! permissions: { student: slug } }
|
116
|
+
scenario 'avatar dorpdown' do
|
117
|
+
visit "/"
|
118
|
+
find('#profileDropdown').click
|
119
|
+
expect(page).to have_text('My account')
|
120
|
+
expect(page).to have_text('FAQs')
|
121
|
+
expect(page).to have_text('Solve other\'s doubts')
|
122
|
+
expect(page).to have_text('My doubts')
|
123
|
+
expect(page).not_to have_text('Classroom')
|
124
|
+
expect(page).not_to have_text('Bibliotheca')
|
125
|
+
expect(page).to have_text('Sign Out')
|
126
|
+
end
|
127
|
+
scenario 'show book' do
|
128
|
+
visit "/"
|
129
|
+
expect(page).to have_text('Chapter 1')
|
130
|
+
expect(page).to have_text('Chapter 2')
|
131
|
+
expect(page).to have_text('Practicing!')
|
132
|
+
end
|
133
|
+
scenario 'show chapter' do
|
134
|
+
visit "/chapters/#{chapter1.id}"
|
135
|
+
expect(page).to have_text('Lesson 11')
|
136
|
+
expect(page).to have_text('Lesson 12')
|
137
|
+
expect(page).to have_text('Exercise 111')
|
138
|
+
expect(page).to have_text('Exercise 112')
|
139
|
+
expect(page).to have_text('Exercise 121')
|
140
|
+
expect(page).to have_text('Exercise 122')
|
141
|
+
end
|
142
|
+
scenario 'show lesson' do
|
143
|
+
visit "/lessons/#{lesson11.id}"
|
144
|
+
expect(page).to have_text('Lesson 11')
|
145
|
+
expect(page).to have_text('Exercise 111')
|
146
|
+
expect(page).to have_text('Exercise 112')
|
147
|
+
expect(page).to have_text('Continue this lesson!')
|
148
|
+
end
|
149
|
+
scenario 'show exercise 111' do
|
150
|
+
visit "/exercises/#{exercise111.id}"
|
151
|
+
expect(page).to have_text('Exercise 111')
|
152
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
153
|
+
expect(page).to have_text('Solve your doubts')
|
154
|
+
end
|
155
|
+
scenario 'show exercise 112' do
|
156
|
+
visit "/exercises/#{exercise112.id}"
|
157
|
+
expect(page).to have_text('Exercise 112')
|
158
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
159
|
+
expect(page).not_to have_text('Solve your doubts')
|
160
|
+
end
|
161
|
+
scenario 'show profile' do
|
162
|
+
visit "/user"
|
163
|
+
expect(page).to have_text('My profile')
|
164
|
+
end
|
165
|
+
scenario 'show faqs' do
|
166
|
+
visit "/faqs"
|
167
|
+
expect(page).to have_text('FAQs')
|
168
|
+
end
|
169
|
+
scenario 'show discussion' do
|
170
|
+
visit "/discussions"
|
171
|
+
expect(page).to have_text('Discussions')
|
172
|
+
end
|
173
|
+
scenario 'show discussion in existent exercise' do
|
174
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
175
|
+
expect(page).to have_text('Exercise 111')
|
176
|
+
expect(page).to have_selector(:link_or_button, 'Comment')
|
177
|
+
end
|
178
|
+
scenario 'show discussion in existent exercise' do
|
179
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
180
|
+
expect(page).to have_text('Exercise 112')
|
181
|
+
expect(page).to have_selector(:link_or_button, 'Comment')
|
182
|
+
end
|
183
|
+
scenario 'new discussion' do
|
184
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
185
|
+
expect(page).to have_text('Exercise 112')
|
186
|
+
expect(page).to have_selector(:link_or_button, 'Publish discussion')
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
context 'and user is ex student of organization' do
|
191
|
+
before { user.update! permissions: { ex_student: slug } }
|
192
|
+
scenario 'avatar dorpdown' do
|
193
|
+
visit "/"
|
194
|
+
find('#profileDropdown').click
|
195
|
+
expect(page).to have_text('My account')
|
196
|
+
expect(page).to have_text('FAQs')
|
197
|
+
expect(page).to have_text('My doubts')
|
198
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
199
|
+
expect(page).not_to have_text('Classroom')
|
200
|
+
expect(page).not_to have_text('Bibliotheca')
|
201
|
+
expect(page).to have_text('Sign Out')
|
202
|
+
end
|
203
|
+
scenario 'show book' do
|
204
|
+
visit "/"
|
205
|
+
expect(page).to have_text('Chapter 1')
|
206
|
+
expect(page).not_to have_text('Chapter 2')
|
207
|
+
expect(page).not_to have_text('Practicing!')
|
208
|
+
end
|
209
|
+
scenario 'show chapter' do
|
210
|
+
visit "/chapters/#{chapter1.id}"
|
211
|
+
expect(page).to have_text('Lesson 11')
|
212
|
+
expect(page).not_to have_text('Lesson 12')
|
213
|
+
expect(page).to have_text('Exercise 111')
|
214
|
+
expect(page).not_to have_text('Exercise 112')
|
215
|
+
expect(page).not_to have_text('Exercise 121')
|
216
|
+
expect(page).not_to have_text('Exercise 122')
|
217
|
+
end
|
218
|
+
scenario 'show lesson' do
|
219
|
+
visit "/lessons/#{lesson11.id}"
|
220
|
+
expect(page).to have_text('Lesson 11')
|
221
|
+
expect(page).to have_text('Exercise 111')
|
222
|
+
expect(page).not_to have_text('Exercise 112')
|
223
|
+
expect(page).not_to have_text('Continue this lesson!')
|
224
|
+
end
|
225
|
+
scenario 'show exercise 111' do
|
226
|
+
visit "/exercises/#{exercise111.id}"
|
227
|
+
expect(page).to have_text('Exercise 111')
|
228
|
+
expect(page).not_to have_selector(:link_or_button, 'Submit')
|
229
|
+
expect(page).not_to have_text('Solve your doubts')
|
230
|
+
end
|
231
|
+
scenario 'show exercise 112' do
|
232
|
+
visit "/exercises/#{exercise112.id}"
|
233
|
+
expect(page).to have_text('You are not allowed to see this content')
|
234
|
+
end
|
235
|
+
scenario 'show profile' do
|
236
|
+
visit "/user"
|
237
|
+
expect(page).to have_text('My profile')
|
238
|
+
end
|
239
|
+
scenario 'show faqs' do
|
240
|
+
visit "/faqs"
|
241
|
+
expect(page).to have_text('FAQs')
|
242
|
+
end
|
243
|
+
scenario 'show discussion' do
|
244
|
+
visit "/discussions"
|
245
|
+
expect(page).to have_text('You are not allowed to see this content')
|
246
|
+
end
|
247
|
+
scenario 'show discussion in existent exercise' do
|
248
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
249
|
+
expect(page).to have_text('Exercise 111')
|
250
|
+
expect(page).not_to have_selector(:link_or_button, 'Comment')
|
251
|
+
end
|
252
|
+
scenario 'show discussion in existent exercise' do
|
253
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
254
|
+
expect(page).to have_text('You are not allowed to see this content')
|
255
|
+
end
|
256
|
+
scenario 'new discussion' do
|
257
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
258
|
+
expect(page).to have_text('You are not allowed to see this content')
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
context 'and user is outsider of organization' do
|
263
|
+
before { user.update! permissions: { ex_student: '', student: '', teacher: '' } }
|
264
|
+
scenario 'avatar dorpdown' do
|
265
|
+
visit "/"
|
266
|
+
find('#profileDropdown').click
|
267
|
+
expect(page).not_to have_text('My account')
|
268
|
+
expect(page).not_to have_text('FAQs')
|
269
|
+
expect(page).not_to have_text('My doubts')
|
270
|
+
expect(page).not_to have_text('Classroom')
|
271
|
+
expect(page).not_to have_text('Bibliotheca')
|
272
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
273
|
+
expect(page).to have_text('Sign Out')
|
274
|
+
end
|
275
|
+
scenario 'show book' do
|
276
|
+
visit "/"
|
277
|
+
expect(page).to have_text('You are not allowed to see this content')
|
278
|
+
end
|
279
|
+
scenario 'show chapter' do
|
280
|
+
visit "/chapters/#{chapter1.id}"
|
281
|
+
expect(page).to have_text('You are not allowed to see this content')
|
282
|
+
end
|
283
|
+
scenario 'show lesson' do
|
284
|
+
visit "/lessons/#{lesson11.id}"
|
285
|
+
expect(page).to have_text('You are not allowed to see this content')
|
286
|
+
end
|
287
|
+
scenario 'show exercise 111' do
|
288
|
+
visit "/exercises/#{exercise111.id}"
|
289
|
+
expect(page).to have_text('You are not allowed to see this content')
|
290
|
+
end
|
291
|
+
scenario 'show exercise 112' do
|
292
|
+
visit "/exercises/#{exercise112.id}"
|
293
|
+
expect(page).to have_text('You are not allowed to see this content')
|
294
|
+
end
|
295
|
+
scenario 'show profile' do
|
296
|
+
visit "/user"
|
297
|
+
expect(page).to have_text('You are not allowed to see this content')
|
298
|
+
end
|
299
|
+
scenario 'show faqs' do
|
300
|
+
visit "/faqs"
|
301
|
+
expect(page).to have_text('You are not allowed to see this content')
|
302
|
+
end
|
303
|
+
scenario 'show discussion' do
|
304
|
+
visit "/discussions"
|
305
|
+
expect(page).to have_text('You are not allowed to see this content')
|
306
|
+
end
|
307
|
+
scenario 'show discussion in existent exercise' do
|
308
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
309
|
+
expect(page).to have_text('You are not allowed to see this content')
|
310
|
+
end
|
311
|
+
scenario 'show discussion in existent exercise' do
|
312
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
313
|
+
expect(page).to have_text('You are not allowed to see this content')
|
314
|
+
end
|
315
|
+
scenario 'new discussion' do
|
316
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
317
|
+
expect(page).to have_text('You are not allowed to see this content')
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
context 'when organization is in preparation' do
|
323
|
+
before { organization.update! in_preparation_until: 1.day.since }
|
324
|
+
|
325
|
+
context 'and user is teacher of organization' do
|
326
|
+
before { user.update! permissions: { teacher: slug } }
|
327
|
+
scenario 'avatar dorpdown' do
|
328
|
+
visit "/"
|
329
|
+
find('#profileDropdown').click
|
330
|
+
expect(page).to have_text('My account')
|
331
|
+
expect(page).to have_text('FAQs')
|
332
|
+
expect(page).to have_text('Classroom')
|
333
|
+
expect(page).to have_text('Solve other\'s doubts')
|
334
|
+
expect(page).to have_text('My doubts')
|
335
|
+
expect(page).not_to have_text('Bibliotheca')
|
336
|
+
expect(page).to have_text('Sign Out')
|
337
|
+
end
|
338
|
+
scenario 'show book' do
|
339
|
+
visit "/"
|
340
|
+
expect(page).to have_text('Chapter 1')
|
341
|
+
expect(page).to have_text('Chapter 2')
|
342
|
+
expect(page).to have_text('Practicing!')
|
343
|
+
end
|
344
|
+
scenario 'show chapter' do
|
345
|
+
visit "/chapters/#{chapter1.id}"
|
346
|
+
expect(page).to have_text('Lesson 11')
|
347
|
+
expect(page).to have_text('Lesson 12')
|
348
|
+
expect(page).to have_text('Exercise 111')
|
349
|
+
expect(page).to have_text('Exercise 112')
|
350
|
+
expect(page).to have_text('Exercise 121')
|
351
|
+
expect(page).to have_text('Exercise 122')
|
352
|
+
end
|
353
|
+
scenario 'show lesson' do
|
354
|
+
visit "/lessons/#{lesson11.id}"
|
355
|
+
expect(page).to have_text('Lesson 11')
|
356
|
+
expect(page).to have_text('Exercise 111')
|
357
|
+
expect(page).to have_text('Exercise 112')
|
358
|
+
expect(page).to have_text('Continue this lesson!')
|
359
|
+
end
|
360
|
+
scenario 'show exercise 111' do
|
361
|
+
visit "/exercises/#{exercise111.id}"
|
362
|
+
expect(page).to have_text('Exercise 111')
|
363
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
364
|
+
expect(page).to have_text('Solve your doubts')
|
365
|
+
end
|
366
|
+
scenario 'show exercise 112' do
|
367
|
+
visit "/exercises/#{exercise112.id}"
|
368
|
+
expect(page).to have_text('Exercise 112')
|
369
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
370
|
+
expect(page).not_to have_text('Solve your doubts')
|
371
|
+
end
|
372
|
+
scenario 'show profile' do
|
373
|
+
visit "/user"
|
374
|
+
expect(page).to have_text('My profile')
|
375
|
+
end
|
376
|
+
scenario 'show faqs' do
|
377
|
+
visit "/faqs"
|
378
|
+
expect(page).to have_text('FAQs')
|
379
|
+
end
|
380
|
+
scenario 'show discussion' do
|
381
|
+
visit "/discussions"
|
382
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
383
|
+
end
|
384
|
+
scenario 'show discussion in existent exercise' do
|
385
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
386
|
+
expect(page).to have_text('Exercise 111')
|
387
|
+
expect(page).to have_selector(:link_or_button, 'Comment')
|
388
|
+
end
|
389
|
+
scenario 'show discussion in existent exercise' do
|
390
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
391
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
392
|
+
end
|
393
|
+
scenario 'new discussion' do
|
394
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
395
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
context 'and user is student of organization' do
|
400
|
+
before { user.update! permissions: { student: slug } }
|
401
|
+
scenario 'avatar dorpdown' do
|
402
|
+
visit "/"
|
403
|
+
find('#profileDropdown').click
|
404
|
+
expect(page).not_to have_text('My account')
|
405
|
+
expect(page).not_to have_text('FAQs')
|
406
|
+
expect(page).not_to have_text('Classroom')
|
407
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
408
|
+
expect(page).not_to have_text('My doubts')
|
409
|
+
expect(page).not_to have_text('Bibliotheca')
|
410
|
+
expect(page).to have_text('Sign Out')
|
411
|
+
end
|
412
|
+
scenario 'show book' do
|
413
|
+
visit "/"
|
414
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
415
|
+
end
|
416
|
+
scenario 'show chapter' do
|
417
|
+
visit "/chapters/#{chapter1.id}"
|
418
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
419
|
+
end
|
420
|
+
scenario 'show lesson' do
|
421
|
+
visit "/lessons/#{lesson11.id}"
|
422
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
423
|
+
end
|
424
|
+
scenario 'show exercise 111' do
|
425
|
+
visit "/exercises/#{exercise111.id}"
|
426
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
427
|
+
end
|
428
|
+
scenario 'show exercise 112' do
|
429
|
+
visit "/exercises/#{exercise112.id}"
|
430
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
431
|
+
end
|
432
|
+
scenario 'show profile' do
|
433
|
+
visit "/user"
|
434
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
435
|
+
end
|
436
|
+
scenario 'show faqs' do
|
437
|
+
visit "/faqs"
|
438
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
439
|
+
end
|
440
|
+
scenario 'show discussion' do
|
441
|
+
visit "/discussions"
|
442
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
443
|
+
end
|
444
|
+
scenario 'show discussion in existent exercise' do
|
445
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
446
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
447
|
+
end
|
448
|
+
scenario 'show discussion in existent exercise' do
|
449
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
450
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
451
|
+
end
|
452
|
+
scenario 'new discussion' do
|
453
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
454
|
+
expect(page).to have_text('This path hasn\'t started yet')
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
context 'and user is ex student of organization' do
|
459
|
+
before { user.update! permissions: { ex_student: slug } }
|
460
|
+
scenario 'avatar dorpdown' do
|
461
|
+
visit "/"
|
462
|
+
find('#profileDropdown').click
|
463
|
+
expect(page).not_to have_text('My account')
|
464
|
+
expect(page).not_to have_text('FAQs')
|
465
|
+
expect(page).not_to have_text('Classroom')
|
466
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
467
|
+
expect(page).not_to have_text('My doubts')
|
468
|
+
expect(page).not_to have_text('Bibliotheca')
|
469
|
+
expect(page).to have_text('Sign Out')
|
470
|
+
end
|
471
|
+
scenario 'show book' do
|
472
|
+
visit "/"
|
473
|
+
expect(page).to have_text('You are not allowed to see this content')
|
474
|
+
end
|
475
|
+
scenario 'show chapter' do
|
476
|
+
visit "/chapters/#{chapter1.id}"
|
477
|
+
expect(page).to have_text('You are not allowed to see this content')
|
478
|
+
end
|
479
|
+
scenario 'show lesson' do
|
480
|
+
visit "/lessons/#{lesson11.id}"
|
481
|
+
expect(page).to have_text('You are not allowed to see this content')
|
482
|
+
end
|
483
|
+
scenario 'show exercise 111' do
|
484
|
+
visit "/exercises/#{exercise111.id}"
|
485
|
+
expect(page).to have_text('You are not allowed to see this content')
|
486
|
+
end
|
487
|
+
scenario 'show exercise 112' do
|
488
|
+
visit "/exercises/#{exercise112.id}"
|
489
|
+
expect(page).to have_text('You are not allowed to see this content')
|
490
|
+
end
|
491
|
+
scenario 'show profile' do
|
492
|
+
visit "/user"
|
493
|
+
expect(page).to have_text('You are not allowed to see this content')
|
494
|
+
end
|
495
|
+
scenario 'show faqs' do
|
496
|
+
visit "/faqs"
|
497
|
+
expect(page).to have_text('You are not allowed to see this content')
|
498
|
+
end
|
499
|
+
scenario 'show discussion' do
|
500
|
+
visit "/discussions"
|
501
|
+
expect(page).to have_text('You are not allowed to see this content')
|
502
|
+
end
|
503
|
+
scenario 'show discussion in existent exercise' do
|
504
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
505
|
+
expect(page).to have_text('You are not allowed to see this content')
|
506
|
+
end
|
507
|
+
scenario 'show discussion in existent exercise' do
|
508
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
509
|
+
expect(page).to have_text('You are not allowed to see this content')
|
510
|
+
end
|
511
|
+
scenario 'new discussion' do
|
512
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
513
|
+
expect(page).to have_text('You are not allowed to see this content')
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
517
|
+
context 'and user is outsider of organization' do
|
518
|
+
before { user.update! permissions: { ex_student: '', student: '', teacher: '' } }
|
519
|
+
scenario 'avatar dorpdown' do
|
520
|
+
visit "/"
|
521
|
+
find('#profileDropdown').click
|
522
|
+
expect(page).not_to have_text('My account')
|
523
|
+
expect(page).not_to have_text('FAQs')
|
524
|
+
expect(page).not_to have_text('My doubts')
|
525
|
+
expect(page).not_to have_text('Classroom')
|
526
|
+
expect(page).not_to have_text('Bibliotheca')
|
527
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
528
|
+
expect(page).to have_text('Sign Out')
|
529
|
+
end
|
530
|
+
scenario 'show book' do
|
531
|
+
visit "/"
|
532
|
+
expect(page).to have_text('You are not allowed to see this content')
|
533
|
+
end
|
534
|
+
scenario 'show chapter' do
|
535
|
+
visit "/chapters/#{chapter1.id}"
|
536
|
+
expect(page).to have_text('You are not allowed to see this content')
|
537
|
+
end
|
538
|
+
scenario 'show lesson' do
|
539
|
+
visit "/lessons/#{lesson11.id}"
|
540
|
+
expect(page).to have_text('You are not allowed to see this content')
|
541
|
+
end
|
542
|
+
scenario 'show exercise 111' do
|
543
|
+
visit "/exercises/#{exercise111.id}"
|
544
|
+
expect(page).to have_text('You are not allowed to see this content')
|
545
|
+
end
|
546
|
+
scenario 'show exercise 112' do
|
547
|
+
visit "/exercises/#{exercise112.id}"
|
548
|
+
expect(page).to have_text('You are not allowed to see this content')
|
549
|
+
end
|
550
|
+
scenario 'show profile' do
|
551
|
+
visit "/user"
|
552
|
+
expect(page).to have_text('You are not allowed to see this content')
|
553
|
+
end
|
554
|
+
scenario 'show faqs' do
|
555
|
+
visit "/faqs"
|
556
|
+
expect(page).to have_text('You are not allowed to see this content')
|
557
|
+
end
|
558
|
+
scenario 'show discussion' do
|
559
|
+
visit "/discussions"
|
560
|
+
expect(page).to have_text('You are not allowed to see this content')
|
561
|
+
end
|
562
|
+
scenario 'show discussion in existent exercise' do
|
563
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
564
|
+
expect(page).to have_text('You are not allowed to see this content')
|
565
|
+
end
|
566
|
+
scenario 'show discussion in existent exercise' do
|
567
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
568
|
+
expect(page).to have_text('You are not allowed to see this content')
|
569
|
+
end
|
570
|
+
scenario 'new discussion' do
|
571
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
572
|
+
expect(page).to have_text('You are not allowed to see this content')
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
context 'when organization is disabled' do
|
578
|
+
before { organization.update! disabled_from: 1.day.ago }
|
579
|
+
|
580
|
+
context 'and user is teacher of organization' do
|
581
|
+
before { user.update! permissions: { teacher: slug } }
|
582
|
+
scenario 'avatar dorpdown' do
|
583
|
+
visit "/"
|
584
|
+
find('#profileDropdown').click
|
585
|
+
expect(page).to have_text('My account')
|
586
|
+
expect(page).to have_text('FAQs')
|
587
|
+
expect(page).to have_text('Classroom')
|
588
|
+
expect(page).to have_text('Solve other\'s doubts')
|
589
|
+
expect(page).to have_text('My doubts')
|
590
|
+
expect(page).not_to have_text('Bibliotheca')
|
591
|
+
expect(page).to have_text('Sign Out')
|
592
|
+
end
|
593
|
+
scenario 'show book' do
|
594
|
+
visit "/"
|
595
|
+
expect(page).to have_text('Chapter 1')
|
596
|
+
expect(page).to have_text('Chapter 2')
|
597
|
+
expect(page).to have_text('Practicing!')
|
598
|
+
end
|
599
|
+
scenario 'show chapter' do
|
600
|
+
visit "/chapters/#{chapter1.id}"
|
601
|
+
expect(page).to have_text('Lesson 11')
|
602
|
+
expect(page).to have_text('Lesson 12')
|
603
|
+
expect(page).to have_text('Exercise 111')
|
604
|
+
expect(page).to have_text('Exercise 112')
|
605
|
+
expect(page).to have_text('Exercise 121')
|
606
|
+
expect(page).to have_text('Exercise 122')
|
607
|
+
end
|
608
|
+
scenario 'show lesson' do
|
609
|
+
visit "/lessons/#{lesson11.id}"
|
610
|
+
expect(page).to have_text('Lesson 11')
|
611
|
+
expect(page).to have_text('Exercise 111')
|
612
|
+
expect(page).to have_text('Exercise 112')
|
613
|
+
expect(page).to have_text('Continue this lesson!')
|
614
|
+
end
|
615
|
+
scenario 'show exercise 111' do
|
616
|
+
visit "/exercises/#{exercise111.id}"
|
617
|
+
expect(page).to have_text('Exercise 111')
|
618
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
619
|
+
expect(page).to have_text('Solve your doubts')
|
620
|
+
end
|
621
|
+
scenario 'show exercise 112' do
|
622
|
+
visit "/exercises/#{exercise112.id}"
|
623
|
+
expect(page).to have_text('Exercise 112')
|
624
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
625
|
+
expect(page).not_to have_text('Solve your doubts')
|
626
|
+
end
|
627
|
+
scenario 'show profile' do
|
628
|
+
visit "/user"
|
629
|
+
expect(page).to have_text('My profile')
|
630
|
+
end
|
631
|
+
scenario 'show faqs' do
|
632
|
+
visit "/faqs"
|
633
|
+
expect(page).to have_text('FAQs')
|
634
|
+
end
|
635
|
+
scenario 'show discussion' do
|
636
|
+
visit "/discussions"
|
637
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
638
|
+
end
|
639
|
+
scenario 'show discussion in existent exercise' do
|
640
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
641
|
+
expect(page).to have_text('Exercise 111')
|
642
|
+
expect(page).to have_selector(:link_or_button, 'Comment')
|
643
|
+
end
|
644
|
+
scenario 'show discussion in existent exercise' do
|
645
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
646
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
647
|
+
end
|
648
|
+
scenario 'new discussion' do
|
649
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
650
|
+
expect(page).not_to have_text('You are not allowed to see this content')
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
context 'and user is student of organization' do
|
655
|
+
before { user.update! permissions: { student: slug } }
|
656
|
+
scenario 'avatar dorpdown' do
|
657
|
+
visit "/"
|
658
|
+
find('#profileDropdown').click
|
659
|
+
expect(page).to have_text('My account')
|
660
|
+
expect(page).to have_text('FAQs')
|
661
|
+
expect(page).to have_text('My doubts')
|
662
|
+
expect(page).not_to have_text('Classroom')
|
663
|
+
expect(page).not_to have_text('Bibliotheca')
|
664
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
665
|
+
expect(page).to have_text('Sign Out')
|
666
|
+
end
|
667
|
+
scenario 'show book' do
|
668
|
+
visit "/"
|
669
|
+
expect(page).to have_text('Chapter 1')
|
670
|
+
expect(page).to have_text('Chapter 2')
|
671
|
+
expect(page).not_to have_text('Practicing!')
|
672
|
+
end
|
673
|
+
scenario 'show chapter' do
|
674
|
+
visit "/chapters/#{chapter1.id}"
|
675
|
+
expect(page).to have_text('Lesson 11')
|
676
|
+
expect(page).to have_text('Lesson 12')
|
677
|
+
expect(page).to have_text('Exercise 111')
|
678
|
+
expect(page).to have_text('Exercise 112')
|
679
|
+
expect(page).to have_text('Exercise 121')
|
680
|
+
expect(page).to have_text('Exercise 122')
|
681
|
+
end
|
682
|
+
scenario 'show lesson' do
|
683
|
+
visit "/lessons/#{lesson11.id}"
|
684
|
+
expect(page).to have_text('Lesson 11')
|
685
|
+
expect(page).to have_text('Exercise 111')
|
686
|
+
expect(page).to have_text('Exercise 112')
|
687
|
+
expect(page).not_to have_text('Continue this lesson!')
|
688
|
+
end
|
689
|
+
scenario 'show exercise 111' do
|
690
|
+
visit "/exercises/#{exercise111.id}"
|
691
|
+
expect(page).to have_text('Exercise 111')
|
692
|
+
expect(page).not_to have_selector(:link_or_button, 'Comment')
|
693
|
+
expect(page).not_to have_text('Solve your doubts')
|
694
|
+
end
|
695
|
+
scenario 'show exercise 112' do
|
696
|
+
visit "/exercises/#{exercise112.id}"
|
697
|
+
expect(page).to have_text('Exercise 112')
|
698
|
+
expect(page).not_to have_selector(:link_or_button, 'Comment')
|
699
|
+
expect(page).not_to have_text('Solve your doubts')
|
700
|
+
end
|
701
|
+
scenario 'show profile' do
|
702
|
+
visit "/user"
|
703
|
+
expect(page).to have_text('My profile')
|
704
|
+
end
|
705
|
+
scenario 'show faqs' do
|
706
|
+
visit "/faqs"
|
707
|
+
expect(page).to have_text('FAQs')
|
708
|
+
end
|
709
|
+
scenario 'show discussion' do
|
710
|
+
visit "/discussions"
|
711
|
+
expect(page).to have_text('You are not allowed to see this content')
|
712
|
+
end
|
713
|
+
scenario 'show discussion in existent exercise' do
|
714
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
715
|
+
expect(page).to have_text('Exercise 111')
|
716
|
+
expect(page).not_to have_selector(:link_or_button, 'Comment')
|
717
|
+
end
|
718
|
+
scenario 'show discussion in existent exercise' do
|
719
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
720
|
+
expect(page).to have_text('You are not allowed to see this content')
|
721
|
+
end
|
722
|
+
scenario 'new discussion' do
|
723
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
724
|
+
expect(page).to have_text('You are not allowed to see this content')
|
725
|
+
end
|
726
|
+
end
|
727
|
+
|
728
|
+
context 'and user is ex student of organization' do
|
729
|
+
before { user.update! permissions: { ex_student: slug } }
|
730
|
+
scenario 'avatar dorpdown' do
|
731
|
+
visit "/"
|
732
|
+
find('#profileDropdown').click
|
733
|
+
expect(page).to have_text('My account')
|
734
|
+
expect(page).to have_text('FAQs')
|
735
|
+
expect(page).not_to have_text('My doubts')
|
736
|
+
expect(page).not_to have_text('Classroom')
|
737
|
+
expect(page).not_to have_text('Bibliotheca')
|
738
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
739
|
+
expect(page).to have_text('Sign Out')
|
740
|
+
end
|
741
|
+
scenario 'show book' do
|
742
|
+
visit "/"
|
743
|
+
expect(page).not_to have_text('Chapter 1')
|
744
|
+
expect(page).not_to have_text('Chapter 2')
|
745
|
+
expect(page).not_to have_text('Practicing!')
|
746
|
+
end
|
747
|
+
scenario 'show chapter' do
|
748
|
+
visit "/chapters/#{chapter1.id}"
|
749
|
+
expect(page).to have_text('You are not allowed to see this content')
|
750
|
+
end
|
751
|
+
scenario 'show lesson' do
|
752
|
+
visit "/lessons/#{lesson11.id}"
|
753
|
+
expect(page).to have_text('You are not allowed to see this content')
|
754
|
+
end
|
755
|
+
scenario 'show exercise 111' do
|
756
|
+
visit "/exercises/#{exercise111.id}"
|
757
|
+
expect(page).to have_text('You are not allowed to see this content')
|
758
|
+
end
|
759
|
+
scenario 'show exercise 112' do
|
760
|
+
visit "/exercises/#{exercise112.id}"
|
761
|
+
expect(page).to have_text('You are not allowed to see this content')
|
762
|
+
end
|
763
|
+
scenario 'show profile' do
|
764
|
+
visit "/user"
|
765
|
+
expect(page).to have_text('My profile')
|
766
|
+
end
|
767
|
+
scenario 'show faqs' do
|
768
|
+
visit "/faqs"
|
769
|
+
expect(page).to have_text('FAQs')
|
770
|
+
end
|
771
|
+
scenario 'show discussion in existent exercise' do
|
772
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
773
|
+
expect(page).to have_text('Page was not found')
|
774
|
+
end
|
775
|
+
scenario 'show discussion in existent exercise' do
|
776
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
777
|
+
expect(page).to have_text('Page was not found')
|
778
|
+
end
|
779
|
+
scenario 'new discussion' do
|
780
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
781
|
+
expect(page).to have_text('Page was not found')
|
782
|
+
end
|
783
|
+
end
|
784
|
+
|
785
|
+
context 'and user is outsider of organization' do
|
786
|
+
before { user.update! permissions: { ex_student: '', student: '', teacher: '' } }
|
787
|
+
scenario 'avatar dorpdown' do
|
788
|
+
visit "/"
|
789
|
+
find('#profileDropdown').click
|
790
|
+
expect(page).not_to have_text('My account')
|
791
|
+
expect(page).not_to have_text('Classroom')
|
792
|
+
expect(page).not_to have_text('Bibliotheca')
|
793
|
+
expect(page).not_to have_text('FAQs')
|
794
|
+
expect(page).not_to have_text('My doubts')
|
795
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
796
|
+
expect(page).to have_text('Sign Out')
|
797
|
+
expect(page).to have_text('You are not allowed to see this content')
|
798
|
+
end
|
799
|
+
scenario 'show book' do
|
800
|
+
visit "/"
|
801
|
+
expect(page).to have_text('You are not allowed to see this content')
|
802
|
+
end
|
803
|
+
scenario 'show chapter' do
|
804
|
+
visit "/chapters/#{chapter1.id}"
|
805
|
+
expect(page).to have_text('You are not allowed to see this content')
|
806
|
+
end
|
807
|
+
scenario 'show lesson' do
|
808
|
+
visit "/lessons/#{lesson11.id}"
|
809
|
+
expect(page).to have_text('You are not allowed to see this content')
|
810
|
+
end
|
811
|
+
scenario 'show exercise 111' do
|
812
|
+
visit "/exercises/#{exercise111.id}"
|
813
|
+
expect(page).to have_text('You are not allowed to see this content')
|
814
|
+
end
|
815
|
+
scenario 'show exercise 112' do
|
816
|
+
visit "/exercises/#{exercise112.id}"
|
817
|
+
expect(page).to have_text('You are not allowed to see this content')
|
818
|
+
end
|
819
|
+
scenario 'show profile' do
|
820
|
+
visit "/user"
|
821
|
+
expect(page).to have_text('You are not allowed to see this content')
|
822
|
+
end
|
823
|
+
scenario 'show faqs' do
|
824
|
+
visit "/faqs"
|
825
|
+
expect(page).to have_text('You are not allowed to see this content')
|
826
|
+
end
|
827
|
+
scenario 'show discussion in existent exercise' do
|
828
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
829
|
+
expect(page).to have_text('You are not allowed to see this content')
|
830
|
+
end
|
831
|
+
scenario 'show discussion in existent exercise' do
|
832
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
833
|
+
expect(page).to have_text('You are not allowed to see this content')
|
834
|
+
end
|
835
|
+
scenario 'new discussion' do
|
836
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
837
|
+
expect(page).to have_text('You are not allowed to see this content')
|
838
|
+
end
|
839
|
+
end
|
840
|
+
end
|
841
|
+
end
|
842
|
+
|
843
|
+
context 'in public organization' do
|
844
|
+
let(:organization) { create :public_organization, book: book }
|
845
|
+
context 'when organization is enabled' do
|
846
|
+
context 'and user is outsider of organization' do
|
847
|
+
before { user.update! permissions: { ex_student: '', student: '', teacher: '' } }
|
848
|
+
scenario 'avatar dorpdown' do
|
849
|
+
visit "/"
|
850
|
+
find('#profileDropdown').click
|
851
|
+
expect(page).to have_text('My account')
|
852
|
+
expect(page).not_to have_text('Classroom')
|
853
|
+
expect(page).not_to have_text('Bibliotheca')
|
854
|
+
expect(page).not_to have_text('FAQs')
|
855
|
+
expect(page).not_to have_text('My doubts')
|
856
|
+
expect(page).not_to have_text('Solve other\'s doubts')
|
857
|
+
expect(page).to have_text('Sign Out')
|
858
|
+
end
|
859
|
+
scenario 'show book' do
|
860
|
+
visit "/"
|
861
|
+
expect(page).to have_text('Chapter 1')
|
862
|
+
expect(page).to have_text('Chapter 2')
|
863
|
+
expect(page).to have_text('Practicing!')
|
864
|
+
end
|
865
|
+
scenario 'show chapter' do
|
866
|
+
visit "/chapters/#{chapter1.id}"
|
867
|
+
expect(page).to have_text('Lesson 11')
|
868
|
+
expect(page).to have_text('Lesson 12')
|
869
|
+
expect(page).to have_text('Exercise 111')
|
870
|
+
expect(page).to have_text('Exercise 112')
|
871
|
+
expect(page).to have_text('Exercise 121')
|
872
|
+
expect(page).to have_text('Exercise 122')
|
873
|
+
end
|
874
|
+
scenario 'show lesson' do
|
875
|
+
visit "/lessons/#{lesson11.id}"
|
876
|
+
expect(page).to have_text('Lesson 11')
|
877
|
+
expect(page).to have_text('Exercise 111')
|
878
|
+
expect(page).to have_text('Exercise 112')
|
879
|
+
expect(page).to have_text('Continue this lesson!')
|
880
|
+
end
|
881
|
+
scenario 'show exercise 111' do
|
882
|
+
visit "/exercises/#{exercise111.id}"
|
883
|
+
expect(page).to have_text('Exercise 111')
|
884
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
885
|
+
expect(page).not_to have_text('Solve your doubts')
|
886
|
+
end
|
887
|
+
scenario 'show exercise 112' do
|
888
|
+
visit "/exercises/#{exercise112.id}"
|
889
|
+
expect(page).to have_text('Exercise 112')
|
890
|
+
expect(page).to have_selector(:link_or_button, 'Submit')
|
891
|
+
expect(page).not_to have_text('Solve your doubts')
|
892
|
+
end
|
893
|
+
scenario 'show profile' do
|
894
|
+
visit "/user"
|
895
|
+
expect(page).to have_text('My profile')
|
896
|
+
end
|
897
|
+
scenario 'show faqs' do
|
898
|
+
visit "/faqs"
|
899
|
+
expect(page).to have_text('Page was not found')
|
900
|
+
end
|
901
|
+
scenario 'show discussion' do
|
902
|
+
visit "/discussions"
|
903
|
+
expect(page).to have_text('Page was not found')
|
904
|
+
end
|
905
|
+
scenario 'show discussion in existent exercise' do
|
906
|
+
visit "/exercises/#{exercise111.id}/discussions/#{discussion111.id}"
|
907
|
+
expect(page).to have_text('Page was not found')
|
908
|
+
end
|
909
|
+
scenario 'show discussion in existent exercise' do
|
910
|
+
visit "/exercises/#{exercise112.id}/discussions/#{discussion112.id}"
|
911
|
+
expect(page).to have_text('Page was not found')
|
912
|
+
end
|
913
|
+
scenario 'new discussion' do
|
914
|
+
visit "/exercises/#{exercise112.id}/discussions/new"
|
915
|
+
expect(page).to have_text('Page was not found')
|
916
|
+
end
|
917
|
+
end
|
918
|
+
end
|
919
|
+
end
|
920
|
+
end
|