mumuki-laboratory 9.0.0 → 9.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mumuki_laboratory/application/certificate.js +17 -0
- data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +43 -2
- data/app/assets/javascripts/mumuki_laboratory/application/faqs.js +90 -0
- data/app/assets/javascripts/mumuki_laboratory/application/organization.js +32 -0
- data/app/assets/javascripts/mumuki_laboratory/application/submissions-store.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/user.js +49 -5
- data/app/assets/stylesheets/mumuki_laboratory/application/_modules.scss +3 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_activity.scss +12 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_certificate.scss +33 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_discussion.scss +14 -2
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_faqs.scss +84 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_menu.scss +30 -2
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +1 -0
- data/app/controllers/certificates_controller.rb +28 -0
- data/app/controllers/concerns/with_certificate_render.rb +25 -0
- data/app/controllers/discussions_messages_controller.rb +6 -2
- data/app/controllers/faqs_controller.rb +6 -0
- data/app/controllers/users_controller.rb +17 -0
- data/app/helpers/certificate_helper.rb +13 -0
- data/app/helpers/discussions_helper.rb +5 -1
- data/app/helpers/links_helper.rb +9 -1
- data/app/helpers/menu_bar_helper.rb +14 -10
- data/app/helpers/user_activity_helper.rb +48 -0
- data/app/helpers/user_menu_helper.rb +27 -5
- data/app/mailers/application_mailer.rb +0 -1
- data/app/mailers/user_mailer.rb +9 -0
- data/app/views/certificates/_certificate.html.erb +44 -0
- data/app/views/certificates/_download.html.erb +20 -0
- data/app/views/certificates/verify.html.erb +40 -0
- data/app/views/discussions/_description_message.html.erb +1 -1
- data/app/views/discussions/_message.html.erb +1 -1
- data/app/views/discussions/_new_message.html.erb +13 -2
- data/app/views/discussions/new.html.erb +1 -1
- data/app/views/faqs/index.html.erb +20 -0
- data/app/views/layouts/_main.html.erb +4 -0
- data/app/views/layouts/_user_menu.html.erb +12 -16
- data/app/views/layouts/application.html.erb +6 -1
- data/app/views/layouts/exercise_inputs/editors/_code.html.erb +2 -1
- data/app/views/user_mailer/certificate.html.erb +339 -0
- data/app/views/user_mailer/certificate.text.erb +10 -0
- data/app/views/users/_activity_indicator.html.erb +17 -0
- data/app/views/users/activity.html.erb +37 -0
- data/app/views/users/certificates.html.erb +32 -0
- data/config/routes.rb +9 -0
- data/lib/mumuki/laboratory/extensions.rb +1 -0
- data/lib/mumuki/laboratory/extensions/date_and_time.rb +11 -0
- data/lib/mumuki/laboratory/locales/en.yml +20 -1
- data/lib/mumuki/laboratory/locales/es-CL.yml +25 -3
- data/lib/mumuki/laboratory/locales/es.yml +25 -3
- data/lib/mumuki/laboratory/locales/pt.yml +26 -1
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/controllers/certificates_controller_spec.rb +15 -0
- data/spec/controllers/discussions_messages_controller_spec.rb +20 -1
- data/spec/dummy/db/schema.rb +5 -1
- data/spec/features/certificate_programs_flow_spec.rb +17 -0
- data/spec/features/discussion_flow_spec.rb +2 -0
- data/spec/features/menu_bar_spec.rb +20 -0
- data/spec/features/profile_flow_spec.rb +12 -0
- data/spec/features/user_activity_flow_spec.rb +65 -0
- data/spec/helpers/application_helper_spec.rb +10 -0
- data/spec/helpers/certificate_helper_spec.rb +15 -0
- data/spec/helpers/user_activity_helper_spec.rb +32 -0
- metadata +171 -99
@@ -16,6 +16,9 @@ pt:
|
|
16
16
|
appendix_teaser: Você quer saber mais? <a href="%{link}"> Consulte o apêndice deste capítulo </a>
|
17
17
|
approved_message: Validado pelo mentor
|
18
18
|
are_you_sure: 'Tem certeza de que deseja %{action}?'
|
19
|
+
approved_messages:
|
20
|
+
one: validado
|
21
|
+
other: validados
|
19
22
|
ask_a_question: Faça uma pergunta!
|
20
23
|
ask_community: Pergunte à comunidade
|
21
24
|
ask_redirect: Você quer que nós o levemos para lá?
|
@@ -33,6 +36,10 @@ pt:
|
|
33
36
|
birthdate: Fecha de nacimiento
|
34
37
|
blocked_forum_explanation: Você está no meio de um exame agora?
|
35
38
|
cancel: Cancelar
|
39
|
+
certificate: Certificado
|
40
|
+
certificates: Certificados
|
41
|
+
certificates_will_be_here: Seus certificados nesta organização aparecerão aqui
|
42
|
+
certificate_verified_legend: "A conta de <strong>% {full_name} </strong> foi verificada. Mumuki certifica a conclusão com sucesso de <strong>% {description} </strong>."
|
36
43
|
chapter: Capítulo
|
37
44
|
chapters: Capítulos
|
38
45
|
chapter_finished_html: Você terminou %{chapter}! Parabéns!
|
@@ -43,6 +50,7 @@ pt:
|
|
43
50
|
closed: Fechado
|
44
51
|
closed_count: '%{count} fechado'
|
45
52
|
comment: Comentar
|
53
|
+
completed_by: Completado por
|
46
54
|
confirm: Confirme
|
47
55
|
confirm_reset: Você está prestes a reiniciar seu exercício. Você quer continuar?
|
48
56
|
confirm_restart: Você está prestes a apagar o seu progresso neste guia. Você quer continuar?
|
@@ -75,6 +83,7 @@ pt:
|
|
75
83
|
discussions_will_be_here: As perguntas que você fizer no espaço de consulta aparecerão aqui.
|
76
84
|
download: Faça o download do que você fez
|
77
85
|
edit: Editar
|
86
|
+
edit_message: Editar mensagem
|
78
87
|
edit_profile: Editar perfil
|
79
88
|
editor_placeholder: ... Escreva sua solução aqui ...
|
80
89
|
email: E-mail
|
@@ -112,6 +121,7 @@ pt:
|
|
112
121
|
expected_state: Tabuleiro esperado
|
113
122
|
explain_redirect: Percebemos que você se registrou em outra organização.
|
114
123
|
failed: Sua solução não passou as provas
|
124
|
+
faqs: Perguntas frequentes
|
115
125
|
feedback: Problemas que encontramos
|
116
126
|
female: Feminino
|
117
127
|
file_exceeds_max_size: "O tamanho do arquivo não deve exceder %{size_kb}kb. Selecione outro arquivo."
|
@@ -159,6 +169,7 @@ pt:
|
|
159
169
|
let_us_know: Por favor, avise-nos!
|
160
170
|
level: Nível
|
161
171
|
level_up: Você sobe de nível!
|
172
|
+
linkedin_profile_button_locale: pt_BR
|
162
173
|
listen_statement: Ouça a declaração
|
163
174
|
loading: Carregando
|
164
175
|
load_solution_into_console: Carregue a solução no console
|
@@ -172,6 +183,10 @@ pt:
|
|
172
183
|
message: Mensagem
|
173
184
|
messages: Mensagens
|
174
185
|
messages_error: As mensagens acima não estão disponíveis no momento. Eu tentei novamente mais tarde!
|
186
|
+
mais tarde!
|
187
|
+
messages_pluralized:
|
188
|
+
one: Mensagem
|
189
|
+
other: Mensagens
|
175
190
|
minute: minuto
|
176
191
|
minutes: minutos
|
177
192
|
moderation: Mentoria
|
@@ -225,6 +240,8 @@ pt:
|
|
225
240
|
permissions: Permissões
|
226
241
|
please_fill_profile_data: Preencha suas informações pessoais para continuar!
|
227
242
|
please_validate: Você está prestes a entrar no curso. Para oferecer uma experiência melhor, valide que seus dados abaixo sejam reais e corretos.
|
243
|
+
preview: Vista prévia
|
244
|
+
preview_error: A visualizaçao não pode ser mostrada. Verifique sua conexão com a internet ou tente com uma mensagem mais curta.
|
228
245
|
previous_exercise: Anterior
|
229
246
|
problem_with_exercise: '[Mumuki] Erro com exercício %{title}'
|
230
247
|
processing_your_solution: Estamos processando sua solução
|
@@ -257,12 +274,18 @@ pt:
|
|
257
274
|
skipped_solve_anyway: Resolver mesmo assim
|
258
275
|
solution: Solução
|
259
276
|
solved: Resolvido
|
260
|
-
solved_count: '%{count} resolvido'
|
261
277
|
solved_exercises: Exercícios resolvidos
|
278
|
+
solved_count:
|
279
|
+
one: 1 resolvido
|
280
|
+
other: '%{count} resolvidos'
|
262
281
|
solve_doubts: Resolvi dúvidas
|
263
282
|
solve_more_exercises_to_level_up: Resolva mais <span>number</span> exercícios para avançar para o próximo nível.
|
264
283
|
solve_your_doubts: Consulte suas dúvidas
|
265
284
|
solve_your_doubts_teaser: Você tem alguma dúvida?
|
285
|
+
solved_exercises_count:
|
286
|
+
one: resolvido
|
287
|
+
other: resolvidos
|
288
|
+
solved_exercises_percentage: realizado
|
266
289
|
something_went_wrong: Oops!, Algo não estava certo ...
|
267
290
|
sort: Ordenar
|
268
291
|
sources: Bibliografia
|
@@ -294,6 +317,7 @@ pt:
|
|
294
317
|
to_pending_review: Marcar como resolvida
|
295
318
|
to_solved: Marcar como resolvida
|
296
319
|
unauthorized_explanation: Opa! Isso é o que é conhecido como %{error}, ou seja, você não fez logon.
|
320
|
+
total: Total
|
297
321
|
uncategorized: Não classificado
|
298
322
|
unlocked_medal_as_avatar: Você ganhou essa medalha! Agora você pode escolhê-la como avatar.
|
299
323
|
unspecified: Eu preferiria não dizer
|
@@ -306,6 +330,7 @@ pt:
|
|
306
330
|
username: Nome de usuário
|
307
331
|
view_details: Ver detalhes
|
308
332
|
want_permissions: O próximo usuário requer permissões
|
333
|
+
week_of: Semana de %{date}
|
309
334
|
welcome: Convidamos você a {name}!
|
310
335
|
working: Processamento
|
311
336
|
wrong_answer: A resposta não é correta
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CertificatesController, type: :controller, organization_workspace: :test do
|
4
|
+
let(:user) { create(:user) }
|
5
|
+
let(:certificate) { create(:certificate, user: user) }
|
6
|
+
|
7
|
+
context 'download' do
|
8
|
+
before { set_current_user! user }
|
9
|
+
before { get :download, params: { code: certificate.code } }
|
10
|
+
|
11
|
+
it { expect(response.status).to eq 200 }
|
12
|
+
it { expect(response.body).to_not be_nil }
|
13
|
+
it { expect(response.content_type).to eq 'application/pdf' }
|
14
|
+
end
|
15
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe DiscussionsMessagesController, organization_workspace: :test do
|
3
|
+
describe DiscussionsMessagesController, type: :controller, organization_workspace: :test do
|
4
4
|
let(:student) { create(:user, permissions: {student: 'test/*'}) }
|
5
5
|
let(:moderator) { create(:user, permissions: {moderator: 'test/*', student: 'test/*'}) }
|
6
6
|
|
@@ -69,5 +69,24 @@ describe DiscussionsMessagesController, organization_workspace: :test do
|
|
69
69
|
it { expect(response.status).to eq 200 }
|
70
70
|
it { expect(message.reload.not_actually_a_question).to be true }
|
71
71
|
end
|
72
|
+
|
73
|
+
describe 'preview' do
|
74
|
+
let(:message) { create(:message, content: 'Message in **bold** and _italics_', discussion: discussion, sender: student.uid) }
|
75
|
+
|
76
|
+
describe 'for student' do
|
77
|
+
before { set_current_user! student }
|
78
|
+
before { get :preview, params: {content: message.content} }
|
79
|
+
|
80
|
+
it { expect(response.status).to eq 403 }
|
81
|
+
end
|
82
|
+
|
83
|
+
describe 'for moderator' do
|
84
|
+
before { set_current_user! moderator }
|
85
|
+
before { get :preview, params: {content: message.content} }
|
86
|
+
|
87
|
+
it { expect(response.status).to eq 200 }
|
88
|
+
it { expect(JSON.parse(response.body)['preview']).to eq "<p>Message in <strong>bold</strong> and <em>italics</em></p>\n" }
|
89
|
+
end
|
90
|
+
end
|
72
91
|
end
|
73
92
|
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: 20210308145910) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
@@ -368,6 +368,9 @@ ActiveRecord::Schema.define(version: 20210119190204) do
|
|
368
368
|
t.integer "discussion_id"
|
369
369
|
t.boolean "approved", default: false
|
370
370
|
t.boolean "not_actually_a_question", default: false
|
371
|
+
t.datetime "approved_at"
|
372
|
+
t.bigint "approved_by_id"
|
373
|
+
t.index ["approved_by_id"], name: "index_messages_on_approved_by_id"
|
371
374
|
end
|
372
375
|
|
373
376
|
create_table "notifications", force: :cascade do |t|
|
@@ -400,6 +403,7 @@ ActiveRecord::Schema.define(version: 20210119190204) do
|
|
400
403
|
t.boolean "wins_page"
|
401
404
|
t.boolean "immersible"
|
402
405
|
t.boolean "prevent_manual_evaluation_content"
|
406
|
+
t.text "faqs"
|
403
407
|
t.index ["book_id"], name: "index_organizations_on_book_id"
|
404
408
|
t.index ["name"], name: "index_organizations_on_name", unique: true
|
405
409
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Certificate Programs flow', organization_workspace: :test do
|
4
|
+
|
5
|
+
let(:user) { create :user, first_name: 'Foo', last_name: 'Bar' }
|
6
|
+
|
7
|
+
before { set_current_user! user }
|
8
|
+
|
9
|
+
before { Organization.find_by_name('test').switch! }
|
10
|
+
before { create :certificate, user: user, code: 'abc' }
|
11
|
+
|
12
|
+
before { visit '/certificates/verify/abc' }
|
13
|
+
|
14
|
+
scenario { expect(page).to have_text('Foo Bar') }
|
15
|
+
scenario { expect(page).to have_link(href: /linkedin\.com\/profile\/add/) }
|
16
|
+
scenario { expect(page).to have_link(href: /certificates\/download\/abc/) }
|
17
|
+
end
|
@@ -169,6 +169,7 @@ feature 'Discussion Flow', organization_workspace: :test do
|
|
169
169
|
expect(page).to have_text(problem_2.name)
|
170
170
|
expect(page).to have_text('Open')
|
171
171
|
expect(page).to have_text('Messages')
|
172
|
+
expect(page).not_to have_text('Preview')
|
172
173
|
expect(page).not_to have_xpath("//div[@class='discussion-actions']")
|
173
174
|
end
|
174
175
|
|
@@ -180,6 +181,7 @@ feature 'Discussion Flow', organization_workspace: :test do
|
|
180
181
|
expect(page).to have_text(problem_2.name)
|
181
182
|
expect(page).to have_text('Open')
|
182
183
|
expect(page).to have_text('Messages')
|
184
|
+
expect(page).to have_text('Preview')
|
183
185
|
expect(page).to have_xpath("//div[@class='discussion-actions']")
|
184
186
|
end
|
185
187
|
end
|
@@ -19,6 +19,7 @@ feature 'menu bar' do
|
|
19
19
|
expect(page).not_to have_text('My account')
|
20
20
|
expect(page).not_to have_text('Classroom')
|
21
21
|
expect(page).not_to have_text('Bibliotheca')
|
22
|
+
expect(page).not_to have_text('FAQs')
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -35,6 +36,7 @@ feature 'menu bar' do
|
|
35
36
|
expect(page).not_to have_text('Bibliotheca')
|
36
37
|
expect(page).not_to have_text('Solve other\'s doubts')
|
37
38
|
expect(page).not_to have_text('My doubts')
|
39
|
+
expect(page).not_to have_text('FAQs')
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -57,6 +59,7 @@ feature 'menu bar' do
|
|
57
59
|
expect(page).not_to have_text('Bibliotheca')
|
58
60
|
expect(page).not_to have_text('Solve other\'s doubts')
|
59
61
|
expect(page).not_to have_text('My doubts')
|
62
|
+
expect(page).not_to have_text('FAQs')
|
60
63
|
end
|
61
64
|
|
62
65
|
context 'student with no discussions should' do
|
@@ -69,6 +72,7 @@ feature 'menu bar' do
|
|
69
72
|
expect(page).not_to have_text('Bibliotheca')
|
70
73
|
expect(page).not_to have_text('Solve other\'s doubts')
|
71
74
|
expect(page).not_to have_text('My doubts')
|
75
|
+
expect(page).not_to have_text('FAQs')
|
72
76
|
end
|
73
77
|
|
74
78
|
scenario 'see their account and solve_other_doubts links if forum is enabled' do
|
@@ -81,6 +85,17 @@ feature 'menu bar' do
|
|
81
85
|
expect(page).not_to have_text('Bibliotheca')
|
82
86
|
expect(page).to have_text('Solve other\'s doubts')
|
83
87
|
expect(page).not_to have_text('My doubts')
|
88
|
+
expect(page).not_to have_text('FAQs')
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'organization with faqs' do
|
93
|
+
before { Organization.current.update! faqs: "Some faqs" }
|
94
|
+
|
95
|
+
scenario 'should see FAQs link' do
|
96
|
+
visit '/'
|
97
|
+
|
98
|
+
expect(page).to have_text('FAQs')
|
84
99
|
end
|
85
100
|
end
|
86
101
|
|
@@ -97,6 +112,7 @@ feature 'menu bar' do
|
|
97
112
|
expect(page).not_to have_text('Bibliotheca')
|
98
113
|
expect(page).not_to have_text('Solve other\'s doubts')
|
99
114
|
expect(page).not_to have_text('My doubts')
|
115
|
+
expect(page).not_to have_text('FAQs')
|
100
116
|
end
|
101
117
|
|
102
118
|
scenario 'see all discussions links if forum is enabled' do
|
@@ -110,6 +126,7 @@ feature 'menu bar' do
|
|
110
126
|
expect(page).not_to have_text('Bibliotheca')
|
111
127
|
expect(page).to have_text('Solve other\'s doubts')
|
112
128
|
expect(page).to have_text('My doubts')
|
129
|
+
expect(page).not_to have_text('FAQs')
|
113
130
|
end
|
114
131
|
|
115
132
|
scenario 'only see their account if forum is enabled in a forum_only_for_trusted organization' do
|
@@ -124,6 +141,7 @@ feature 'menu bar' do
|
|
124
141
|
expect(page).not_to have_text('Bibliotheca')
|
125
142
|
expect(page).not_to have_text('Solve other\'s doubts')
|
126
143
|
expect(page).not_to have_text('My doubts')
|
144
|
+
expect(page).not_to have_text('FAQs')
|
127
145
|
end
|
128
146
|
|
129
147
|
scenario 'see all discussions links if forum is enabled in a forum_only_for_trusted organization but it is trusted' do
|
@@ -139,6 +157,7 @@ feature 'menu bar' do
|
|
139
157
|
expect(page).not_to have_text('Bibliotheca')
|
140
158
|
expect(page).to have_text('Solve other\'s doubts')
|
141
159
|
expect(page).to have_text('My doubts')
|
160
|
+
expect(page).not_to have_text('FAQs')
|
142
161
|
end
|
143
162
|
end
|
144
163
|
|
@@ -152,6 +171,7 @@ feature 'menu bar' do
|
|
152
171
|
expect(page).not_to have_text('Bibliotheca')
|
153
172
|
expect(page).not_to have_text('Solve other\'s doubts')
|
154
173
|
expect(page).not_to have_text('My doubts')
|
174
|
+
expect(page).not_to have_text('FAQs')
|
155
175
|
end
|
156
176
|
|
157
177
|
scenario 'writer should see their account and bibliotheca' do
|
@@ -121,5 +121,17 @@ feature 'Profile Flow', organization_workspace: :test do
|
|
121
121
|
expect(page).to have_text(problem.name)
|
122
122
|
end
|
123
123
|
end
|
124
|
+
|
125
|
+
context 'visit certificates tab' do
|
126
|
+
before { Organization.find_by_name('test').switch! }
|
127
|
+
before { create :certificate, user: user, code: 'abc' }
|
128
|
+
before { visit '/user/certificates' }
|
129
|
+
|
130
|
+
scenario { expect(page).to have_text('Test - Certificate program to test') }
|
131
|
+
scenario { expect(page).to have_link(href: /certificates\/verify\/abc/) }
|
132
|
+
scenario { expect(page).to have_link(href: /linkedin.com\/profile\/add/) }
|
133
|
+
scenario { expect(page).to have_link(href: /certificates\/download\/abc/) }
|
134
|
+
end
|
135
|
+
|
124
136
|
end
|
125
137
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'User Activity Flow', organization_workspace: :test do
|
4
|
+
let(:user) { create(:user) }
|
5
|
+
before { set_current_user!(user) }
|
6
|
+
|
7
|
+
let(:fake_stats) { double('stats') }
|
8
|
+
before do
|
9
|
+
allow(UserStats).to receive(:stats_for).and_return(fake_stats)
|
10
|
+
allow(fake_stats).to receive(:activity).and_return(
|
11
|
+
{ exercises: { solved_count: 8, count: 10 },
|
12
|
+
messages: { count: 12, approved: 6 } })
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:week_start) { Time.new(2020, 10, 12) }
|
16
|
+
before do
|
17
|
+
allow(Time).to receive(:now).and_return(week_start)
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'total' do
|
21
|
+
before { visit activity_user_path }
|
22
|
+
|
23
|
+
scenario 'displays exercises done percentage' do
|
24
|
+
expect(page).to have_text('80%')
|
25
|
+
expect(page).to have_text('done')
|
26
|
+
end
|
27
|
+
|
28
|
+
scenario 'displays exercises solved count' do
|
29
|
+
expect(page).to have_text('8')
|
30
|
+
expect(page).to have_text('solved')
|
31
|
+
end
|
32
|
+
|
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
|
+
scenario 'displays recent weeks' do
|
44
|
+
expect(page).to have_text 'Week of 2020-10-12'
|
45
|
+
expect(page).to have_text 'Week of 2020-10-05'
|
46
|
+
expect(page).to have_text 'Week of 2020-09-28'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'selecting a specific week' do
|
51
|
+
before do
|
52
|
+
visit activity_user_path
|
53
|
+
click_on 'Week of 2020-10-12'
|
54
|
+
end
|
55
|
+
|
56
|
+
scenario "redirects to week activity" do
|
57
|
+
expect(page).to have_current_path('/user/activity?date_from=2020-10-12&date_to=2020-10-19')
|
58
|
+
end
|
59
|
+
|
60
|
+
scenario "doesn't display exercises done percentage" do
|
61
|
+
expect(page).not_to have_text('80%')
|
62
|
+
expect(page).not_to have_text('done')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -26,4 +26,14 @@ describe ApplicationHelper, organization_workspace: :test do
|
|
26
26
|
it { expect(link_to_path_element(lesson)).to start_with '<a href="/lessons/1-foo">foo' }
|
27
27
|
end
|
28
28
|
|
29
|
+
describe 'bibliotheca links' do
|
30
|
+
let(:current_user) { create(:user) }
|
31
|
+
let(:lesson) { create(:lesson, id: 1, name: 'foo') }
|
32
|
+
let(:guide) { lesson.guide }
|
33
|
+
|
34
|
+
before { current_user.make_editor_of! guide.slug }
|
35
|
+
|
36
|
+
it { expect(url_for_bibliotheca_guide(guide)).to start_with 'http://bibliotheca.localmumuki.io/#/guides/mumuki/mumuki-test-lesson' }
|
37
|
+
end
|
38
|
+
|
29
39
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CertificateHelper, organization_workspace: :test do
|
4
|
+
helper CertificateHelper
|
5
|
+
|
6
|
+
describe '#linkedin_url_to_post' do
|
7
|
+
|
8
|
+
let(:certificate) { create :certificate, code: 'abc', created_at: Time.new(2000, 1, 1) }
|
9
|
+
let(:link) { "https://www.linkedin.com/profile/add?startTask=CERTIFICATION_NAME&name=Test&organizationId=1&issueYear=2000&issueMonth=1&certUrl=http%3A%2F%2Ftest.localmumuki.io%2Fcertificates%2Fverify%2Fabc&certId=abc" }
|
10
|
+
|
11
|
+
before { allow(ENV).to receive(:[]).with('MUMUKI_LINKEDIN_ORGANIZATION_ID').and_return '1' }
|
12
|
+
it { expect(linkedin_post_url(certificate).to_s).to eq link }
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe UserActivityHelper, organization_workspace: :test do
|
4
|
+
helper UserActivityHelper
|
5
|
+
|
6
|
+
let(:organization) { Organization.current }
|
7
|
+
|
8
|
+
before do
|
9
|
+
# Set today date to Wednesday to test week always starts on Monday
|
10
|
+
allow(Date).to receive(:today).and_return(Date.new(2021, 2, 10))
|
11
|
+
allow_any_instance_of(UserActivityHelper).to receive(:min_week).and_return(8.weeks.ago(Date.today))
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'activity_selector_week_range_for' do
|
15
|
+
let(:range) { activity_selector_week_range_for organization }
|
16
|
+
let(:closest_monday) { Date.new(2021, 2, 8) }
|
17
|
+
|
18
|
+
context 'organization without in preparation until' do
|
19
|
+
it { expect(range.length).to eq 9 }
|
20
|
+
it { expect(range.first).to eq [closest_monday, 1.week.since(closest_monday).to_date] }
|
21
|
+
it { expect(range.last).to eq [8.week.ago(closest_monday).to_date, 7.week.ago(closest_monday).to_date] }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'organization with in preparation until' do
|
25
|
+
before { organization.update! in_preparation_until: 3.week.ago(Date.today) }
|
26
|
+
|
27
|
+
it { expect(range.length).to eq 4 }
|
28
|
+
it { expect(range.first).to eq [closest_monday, 1.week.since(closest_monday).to_date] }
|
29
|
+
it { expect(range.last).to eq [3.week.ago(closest_monday).to_date, 2.week.ago(closest_monday).to_date] }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|