mumuki-laboratory 9.0.1 → 9.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mumuki_laboratory/application/certificate.js +17 -0
  3. data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +10 -2
  4. data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +43 -2
  5. data/app/assets/javascripts/mumuki_laboratory/application/faqs.js +90 -0
  6. data/app/assets/javascripts/mumuki_laboratory/application/multiple-files.js +7 -0
  7. data/app/assets/javascripts/mumuki_laboratory/application/organization.js +32 -0
  8. data/app/assets/javascripts/mumuki_laboratory/application/submissions-store.js +1 -1
  9. data/app/assets/javascripts/mumuki_laboratory/application/user.js +49 -5
  10. data/app/assets/stylesheets/mumuki_laboratory/application/_modules.scss +3 -0
  11. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_activity.scss +12 -0
  12. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_certificate.scss +33 -0
  13. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_discussion.scss +14 -2
  14. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_faqs.scss +84 -0
  15. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_terms.scss +3 -2
  16. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_menu.scss +30 -2
  17. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +1 -0
  18. data/app/controllers/certificates_controller.rb +28 -0
  19. data/app/controllers/concerns/with_certificate_render.rb +25 -0
  20. data/app/controllers/discussions_messages_controller.rb +6 -2
  21. data/app/controllers/faqs_controller.rb +6 -0
  22. data/app/controllers/users_controller.rb +17 -0
  23. data/app/helpers/certificate_helper.rb +13 -0
  24. data/app/helpers/discussions_helper.rb +5 -1
  25. data/app/helpers/links_helper.rb +8 -0
  26. data/app/helpers/menu_bar_helper.rb +14 -10
  27. data/app/helpers/multiple_file_editor_helper.rb +2 -1
  28. data/app/helpers/user_activity_helper.rb +48 -0
  29. data/app/helpers/user_menu_helper.rb +27 -5
  30. data/app/mailers/application_mailer.rb +0 -1
  31. data/app/mailers/user_mailer.rb +9 -0
  32. data/app/views/certificates/_certificate.html.erb +44 -0
  33. data/app/views/certificates/_download.html.erb +20 -0
  34. data/app/views/certificates/verify.html.erb +40 -0
  35. data/app/views/discussions/_description_message.html.erb +1 -1
  36. data/app/views/discussions/_message.html.erb +1 -1
  37. data/app/views/discussions/_new_message.html.erb +13 -2
  38. data/app/views/discussions/new.html.erb +1 -1
  39. data/app/views/faqs/index.html.erb +20 -0
  40. data/app/views/layouts/_main.html.erb +4 -0
  41. data/app/views/layouts/_user_menu.html.erb +13 -16
  42. data/app/views/layouts/application.html.erb +6 -1
  43. data/app/views/layouts/exercise_inputs/editors/_code.html.erb +2 -1
  44. data/app/views/layouts/exercise_inputs/editors/_multiple_files.html.erb +1 -1
  45. data/app/views/user_mailer/certificate.html.erb +339 -0
  46. data/app/views/user_mailer/certificate.text.erb +10 -0
  47. data/app/views/users/_activity_indicator.html.erb +17 -0
  48. data/app/views/users/activity.html.erb +37 -0
  49. data/app/views/users/certificates.html.erb +32 -0
  50. data/config/initializers/inflections.rb +3 -0
  51. data/config/routes.rb +9 -0
  52. data/lib/mumuki/laboratory/extensions.rb +1 -0
  53. data/lib/mumuki/laboratory/extensions/date_and_time.rb +11 -0
  54. data/lib/mumuki/laboratory/locales/en.yml +20 -1
  55. data/lib/mumuki/laboratory/locales/es-CL.yml +25 -3
  56. data/lib/mumuki/laboratory/locales/es.yml +25 -3
  57. data/lib/mumuki/laboratory/locales/pt.yml +26 -1
  58. data/lib/mumuki/laboratory/version.rb +1 -1
  59. data/spec/controllers/certificates_controller_spec.rb +15 -0
  60. data/spec/controllers/discussions_messages_controller_spec.rb +20 -1
  61. data/spec/dummy/db/schema.rb +20 -3
  62. data/spec/features/certificate_programs_flow_spec.rb +17 -0
  63. data/spec/features/discussion_flow_spec.rb +2 -0
  64. data/spec/features/menu_bar_spec.rb +20 -0
  65. data/spec/features/profile_flow_spec.rb +12 -0
  66. data/spec/features/user_activity_flow_spec.rb +65 -0
  67. data/spec/helpers/certificate_helper_spec.rb +15 -0
  68. data/spec/helpers/user_activity_helper_spec.rb +32 -0
  69. metadata +170 -97
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Laboratory
3
- VERSION = '9.0.1'
3
+ VERSION = '9.0.6'
4
4
  end
5
5
  end
@@ -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
@@ -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: 20210119190204) do
13
+ ActiveRecord::Schema.define(version: 20210330175706) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
@@ -79,14 +79,16 @@ ActiveRecord::Schema.define(version: 20210119190204) do
79
79
  t.bigint "organization_id"
80
80
  t.datetime "created_at", null: false
81
81
  t.datetime "updated_at", null: false
82
+ t.datetime "start_date"
83
+ t.datetime "end_date"
82
84
  t.index ["organization_id"], name: "index_certificate_programs_on_organization_id"
83
85
  end
84
86
 
85
87
  create_table "certificates", force: :cascade do |t|
86
88
  t.bigint "user_id"
87
89
  t.bigint "certificate_program_id"
88
- t.datetime "start_date"
89
- t.datetime "end_date"
90
+ t.datetime "started_at"
91
+ t.datetime "ended_at"
90
92
  t.string "code"
91
93
  t.datetime "created_at", null: false
92
94
  t.datetime "updated_at", null: false
@@ -121,6 +123,8 @@ ActiveRecord::Schema.define(version: 20210119190204) do
121
123
  t.integer "organization_id"
122
124
  t.datetime "created_at", null: false
123
125
  t.datetime "updated_at", null: false
126
+ t.datetime "period_start"
127
+ t.datetime "period_end"
124
128
  end
125
129
 
126
130
  create_table "discussions", force: :cascade do |t|
@@ -199,6 +203,13 @@ ActiveRecord::Schema.define(version: 20210119190204) do
199
203
  t.index ["exam_registration_id"], name: "index_exam_registrations_exams_on_exam_registration_id"
200
204
  end
201
205
 
206
+ create_table "exam_registrations_users", id: false, force: :cascade do |t|
207
+ t.bigint "exam_registration_id", null: false
208
+ t.bigint "user_id", null: false
209
+ t.index ["exam_registration_id"], name: "index_exam_registrations_users_on_exam_registration_id"
210
+ t.index ["user_id"], name: "index_exam_registrations_users_on_user_id"
211
+ end
212
+
202
213
  create_table "exams", id: :serial, force: :cascade do |t|
203
214
  t.integer "organization_id"
204
215
  t.integer "guide_id"
@@ -368,6 +379,9 @@ ActiveRecord::Schema.define(version: 20210119190204) do
368
379
  t.integer "discussion_id"
369
380
  t.boolean "approved", default: false
370
381
  t.boolean "not_actually_a_question", default: false
382
+ t.datetime "approved_at"
383
+ t.bigint "approved_by_id"
384
+ t.index ["approved_by_id"], name: "index_messages_on_approved_by_id"
371
385
  end
372
386
 
373
387
  create_table "notifications", force: :cascade do |t|
@@ -400,6 +414,7 @@ ActiveRecord::Schema.define(version: 20210119190204) do
400
414
  t.boolean "wins_page"
401
415
  t.boolean "immersible"
402
416
  t.boolean "prevent_manual_evaluation_content"
417
+ t.text "faqs"
403
418
  t.index ["book_id"], name: "index_organizations_on_book_id"
404
419
  t.index ["name"], name: "index_organizations_on_name", unique: true
405
420
  end
@@ -506,6 +521,8 @@ ActiveRecord::Schema.define(version: 20210119190204) do
506
521
  t.datetime "forum_terms_accepted_at"
507
522
  t.boolean "banned_from_forum"
508
523
  t.boolean "uppercase_mode"
524
+ t.string "delete_account_token"
525
+ t.datetime "delete_account_token_expiration_date"
509
526
  t.index ["avatar_type", "avatar_id"], name: "index_users_on_avatar_type_and_avatar_id"
510
527
  t.index ["disabled_at"], name: "index_users_on_disabled_at"
511
528
  t.index ["last_organization_id"], name: "index_users_on_last_organization_id"
@@ -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
@@ -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