mumuki-laboratory 7.0.2 → 7.0.3
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/assets-loader.js +26 -0
- data/app/assets/javascripts/mumuki_laboratory/application/button.js +36 -0
- data/app/assets/javascripts/mumuki_laboratory/application/kids.js +10 -1
- data/app/assets/javascripts/mumuki_laboratory/application/submission.js +12 -33
- data/app/controllers/login_controller.rb +1 -0
- data/app/helpers/menu_bar_helper.rb +10 -1
- data/app/helpers/runner_assets_helper.rb +6 -2
- data/app/views/exercises/_read_only.html.erb +1 -1
- data/app/views/exercises/show.html.erb +1 -1
- data/app/views/layouts/_runner_assets.html.erb +8 -0
- data/app/views/layouts/application.html.erb +0 -1
- data/app/views/layouts/modals/_kids_context.html.erb +1 -1
- data/lib/mumuki/laboratory/locales/en.yml +1 -0
- data/lib/mumuki/laboratory/locales/es.yml +1 -0
- data/lib/mumuki/laboratory/locales/pt.yml +1 -0
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/features/guide_reset_spec.rb +1 -1
- data/spec/features/links_flow_spec.rb +1 -1
- data/spec/features/login_flow_spec.rb +1 -1
- data/spec/features/menu_bar_spec.rb +69 -7
- data/spec/features/not_found_private_flow_spec.rb +1 -1
- data/spec/features/not_found_public_flow_spec.rb +1 -1
- data/spec/features/profile_flow_spec.rb +28 -14
- data/spec/features/runner_assets_spec.rb +58 -0
- data/spec/login_helper.rb +4 -1
- data/spec/spec_helper.rb +2 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6896f137f401b7b8bb5dd0738e580438a7960eee6abb275b48391fe0a923241
|
4
|
+
data.tar.gz: eedc5012f387ccbd9ecfe02f4a5ff3a4395ee35b47a6a1ca6e1bee6902c37a71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ada54c64c5dd5322437da49812d4ff5b7559b6568a0a8812026018675e47b77f7d9c66bb8c16ff19103a7cd6fa93383a1c8ae62647ed548de79ce2dde080c40
|
7
|
+
data.tar.gz: 5a9ddca63b8d823111ce73dc5329b69c9a1a556b1427178afe6827e50209a22a38289b0f0c08679da7200c48b267e249393e534745e4eca4b638bb17716db12e
|
@@ -0,0 +1,26 @@
|
|
1
|
+
const assetsLoader = {
|
2
|
+
layout: {
|
3
|
+
onLoadingStarted: function () {
|
4
|
+
|
5
|
+
},
|
6
|
+
onLoadingFinished: function () {
|
7
|
+
|
8
|
+
}
|
9
|
+
},
|
10
|
+
editor: {
|
11
|
+
onLoadingStarted: function () {
|
12
|
+
mumuki.kids.disableContextModalButton();
|
13
|
+
},
|
14
|
+
onLoadingFinished: function () {
|
15
|
+
mumuki.kids.enableContextModalButton();
|
16
|
+
}
|
17
|
+
}
|
18
|
+
};
|
19
|
+
|
20
|
+
mumuki.assetsLoaderFor = function (kind) {
|
21
|
+
assetsLoader[kind].onLoadingStarted();
|
22
|
+
};
|
23
|
+
|
24
|
+
mumuki.assetsLoadedFor = function (kind) {
|
25
|
+
assetsLoader[kind].onLoadingFinished();
|
26
|
+
};
|
@@ -0,0 +1,36 @@
|
|
1
|
+
mumuki.Button = class {
|
2
|
+
|
3
|
+
constructor($button, $container) {
|
4
|
+
this.$button = $button;
|
5
|
+
this.$container = $container || $button;
|
6
|
+
this.originalContent = $button.html();
|
7
|
+
}
|
8
|
+
|
9
|
+
disable () {
|
10
|
+
this.$container.attr('disabled', 'disabled');
|
11
|
+
}
|
12
|
+
|
13
|
+
setWaiting () {
|
14
|
+
this.preventClick();
|
15
|
+
this.setWaitingText();
|
16
|
+
}
|
17
|
+
|
18
|
+
enable () {
|
19
|
+
this.setOriginalContent();
|
20
|
+
this.$container.removeAttr('disabled');
|
21
|
+
}
|
22
|
+
|
23
|
+
setWaitingText () {
|
24
|
+
this.$button.html('<i class="fa fa-refresh fa-spin"></i> ' + this.$button.attr('data-waiting'));
|
25
|
+
}
|
26
|
+
|
27
|
+
setOriginalContent () {
|
28
|
+
this.$button.html(this.originalContent);
|
29
|
+
}
|
30
|
+
|
31
|
+
preventClick () {
|
32
|
+
this.disable();
|
33
|
+
this.$button.on('click', (e) => e.preventDefault());
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
@@ -12,8 +12,9 @@ mumuki.load(function () {
|
|
12
12
|
var $defaultSpeechTabName = 'description';
|
13
13
|
var $texts = $bubble.children(availableTabs.join(", "));
|
14
14
|
var $hint = $('.mu-kids-hint');
|
15
|
-
var discussionsLinkHtml = $('#mu-kids-discussion-link-html').html();
|
16
15
|
var $description = $('.mu-kids-description');
|
16
|
+
var discussionsLinkHtml = $('#mu-kids-discussion-link-html').html();
|
17
|
+
var contextModalButton = new mumuki.Button($('.mu-kids-context .modal-footer button'));
|
17
18
|
|
18
19
|
function floatFromPx(value) {
|
19
20
|
return parseFloat(value.substring(0, value.length - 2));
|
@@ -125,6 +126,14 @@ mumuki.load(function () {
|
|
125
126
|
mumuki.presenterCharacter.playAnimation('talk', mumuki.kids._getCharacterImage());
|
126
127
|
},
|
127
128
|
|
129
|
+
disableContextModalButton: function () {
|
130
|
+
contextModalButton.setWaiting();
|
131
|
+
},
|
132
|
+
|
133
|
+
enableContextModalButton: function () {
|
134
|
+
contextModalButton.enable();
|
135
|
+
},
|
136
|
+
|
128
137
|
// ===========
|
129
138
|
// Private API
|
130
139
|
// ===========
|
@@ -28,45 +28,24 @@ var mumuki = mumuki || {};
|
|
28
28
|
}
|
29
29
|
};
|
30
30
|
|
31
|
-
|
32
|
-
this.submitButton = submitButton;
|
33
|
-
this.submissionControls = submissionControls;
|
34
|
-
}
|
31
|
+
class SubmitButton extends mumuki.Button {
|
35
32
|
|
36
|
-
|
37
|
-
disable: function () {
|
38
|
-
this.submissionControls.attr('disabled', 'disabled');
|
39
|
-
},
|
40
|
-
setWaitingText: function () {
|
41
|
-
document.prevSubmitState = this.submitButton.html();
|
42
|
-
this.submitButton.html('<i class="fa fa-refresh fa-spin"></i> ' + this.submitButton.attr('data-waiting'));
|
43
|
-
},
|
44
|
-
setSendText: function () {
|
45
|
-
this.submitButton.html(document.prevSubmitState);
|
46
|
-
},
|
47
|
-
enable: function () {
|
48
|
-
this.setSendText();
|
49
|
-
this.submissionControls.removeAttr('disabled');
|
50
|
-
},
|
51
|
-
reachedMaxAttempts: function () {
|
33
|
+
reachedMaxAttempts () {
|
52
34
|
return $('#attempts-left-text').attr('data-disabled') === "true";
|
53
|
-
}
|
54
|
-
|
35
|
+
}
|
36
|
+
|
37
|
+
updateAttemptsLeft (data) {
|
55
38
|
$('#attempts-left-text').replaceWith(data['remaining_attempts_html']);
|
56
39
|
this.checkAttemptsLeft();
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
this.submitButton.on('click', function (e) {
|
61
|
-
e.preventDefault();
|
62
|
-
})
|
63
|
-
},
|
64
|
-
checkAttemptsLeft: function () {
|
40
|
+
}
|
41
|
+
|
42
|
+
checkAttemptsLeft () {
|
65
43
|
if (this.reachedMaxAttempts()) {
|
66
|
-
this.
|
44
|
+
this.preventClick();
|
67
45
|
}
|
68
46
|
}
|
69
|
-
|
47
|
+
|
48
|
+
}
|
70
49
|
|
71
50
|
mumuki.load(function () {
|
72
51
|
var submissionsResults = $('.submission-results');
|
@@ -119,7 +98,7 @@ var mumuki = mumuki || {};
|
|
119
98
|
|
120
99
|
function animateTimeoutError(submitButton) {
|
121
100
|
let scene = new muvment.Scene($('.submission-result-error-animation'));
|
122
|
-
scene.addState(mumuki.errorState('timeout_1').onStart(submitButton.
|
101
|
+
scene.addState(mumuki.errorState('timeout_1').onStart(submitButton.setOriginalContent.bind(submitButton)).onEndSwitch(scene, 'timeout_2'))
|
123
102
|
.addState(mumuki.errorState('timeout_2').onEndSwitch(scene, 'timeout_3'))
|
124
103
|
.addState(mumuki.errorState('timeout_3').onStart(submitButton.enable.bind(submitButton)))
|
125
104
|
.play();
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module MenuBarHelper
|
2
2
|
def menu_bar_links
|
3
3
|
[
|
4
|
+
link_to_profile,
|
4
5
|
link_to_classroom,
|
5
6
|
link_to_bibliotheca,
|
6
7
|
solve_discussions_link,
|
@@ -9,7 +10,15 @@ module MenuBarHelper
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def menu_bar_list_items
|
12
|
-
menu_bar_links.compact.map { |link|
|
13
|
+
menu_bar_links.compact.map { |link| li_tag(link) }.join.html_safe
|
14
|
+
end
|
15
|
+
|
16
|
+
def li_tag(link)
|
17
|
+
content_tag :li, link
|
18
|
+
end
|
19
|
+
|
20
|
+
def link_to_profile
|
21
|
+
li_tag menu_item('user-o', :profile, user_path)
|
13
22
|
end
|
14
23
|
|
15
24
|
def link_to_classroom
|
@@ -1,5 +1,9 @@
|
|
1
1
|
module RunnerAssetsHelper
|
2
|
-
def render_runner_assets(language, assets_kind)
|
3
|
-
render partial: 'layouts/runner_assets', locals: {language: language, assets_kind: assets_kind}
|
2
|
+
def render_runner_assets(language, assets_kind, loads_more_assets: false)
|
3
|
+
render partial: 'layouts/runner_assets', locals: {language: language, assets_kind: assets_kind, loads_more_assets: loads_more_assets}
|
4
|
+
end
|
5
|
+
|
6
|
+
def show_loading_for?(language, assets_kind)
|
7
|
+
language.send "#{assets_kind}_shows_loading_content"
|
4
8
|
end
|
5
9
|
end
|
@@ -9,3 +9,11 @@
|
|
9
9
|
<% language.assets_urls_for(assets_kind, :css).each do |css| %>
|
10
10
|
<link rel="stylesheet" href="<%= css %>" />
|
11
11
|
<% end %>
|
12
|
+
|
13
|
+
<% if !loads_more_assets && show_loading_for?(language, assets_kind) %>
|
14
|
+
<script id="<%= assets_kind %>-loading-script">
|
15
|
+
let assetsKind = '<%= assets_kind %>';
|
16
|
+
mumuki.load(() => mumuki.assetsLoaderFor(assetsKind));
|
17
|
+
</script>
|
18
|
+
<% end %>
|
19
|
+
|
@@ -31,7 +31,6 @@
|
|
31
31
|
<%= profile_picture %>
|
32
32
|
</span>
|
33
33
|
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="profileDropdown">
|
34
|
-
<li><%= link_to fixed_fa_icon('user-o', text: t(:profile)), user_path, role: 'menuitem' %></li>
|
35
34
|
<%= menu_bar_list_items %>
|
36
35
|
<li class="divider"></li>
|
37
36
|
<li><%= link_to(t(:sign_out), logout_path(origin: url_for), role: 'menuitem') %></li>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
</div>
|
18
18
|
</div>
|
19
19
|
<div class="modal-footer">
|
20
|
-
<button class="btn btn-success btn-block" data-dismiss="modal" aria-label="<%= t :continue_exercise %>"> <%= t :continue_exercise %> </button>
|
20
|
+
<button class="btn btn-success btn-block" data-waiting="<%= t :loading %>" data-dismiss="modal" aria-label="<%= t :continue_exercise %>"> <%= t :continue_exercise %> </button>
|
21
21
|
</div>
|
22
22
|
</div>
|
23
23
|
</div>
|
@@ -112,6 +112,7 @@ en:
|
|
112
112
|
lesson: Lesson
|
113
113
|
lesson_number: Lesson %{number}
|
114
114
|
let_us_know: please let us know!
|
115
|
+
loading: Loading
|
115
116
|
load_solution_into_console: Load your solution into the console
|
116
117
|
male: Male
|
117
118
|
manual_evaluation_pending: Thanks for submitting your solution! It will be revised by the course teachers soon
|
@@ -124,6 +124,7 @@ es:
|
|
124
124
|
lesson: Lección
|
125
125
|
lesson_number: Lección %{number}
|
126
126
|
let_us_know: ¡Por favor avisanos!
|
127
|
+
loading: Cargando
|
127
128
|
load_solution_into_console: Cargar la solución en la consola
|
128
129
|
male: Hombre
|
129
130
|
manual_evaluation_pending: ¡Gracias por enviar tu solución! Tus docentes la corregirán pronto
|
@@ -119,6 +119,7 @@ pt:
|
|
119
119
|
lesson: Lição
|
120
120
|
lesson_number: Lição %{number}
|
121
121
|
let_us_know: Por favor, avise-nos!
|
122
|
+
loading: Carregando
|
122
123
|
load_solution_into_console: Carregue a solução no console
|
123
124
|
male: Masculino
|
124
125
|
manual_evaluation_pending: Obrigado por enviar sua solução! Seus professores irão corrigi-lo em breve
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
feature '
|
3
|
+
feature 'Links Flow', organization_workspace: :test do
|
4
4
|
let(:exercise) { create(:exercise, name: 'E1') }
|
5
5
|
let!(:complement) { create(:complement) }
|
6
6
|
let!(:lesson) { create(:lesson, name: 'L1', exercises: [exercise]) }
|
@@ -9,7 +9,7 @@ feature 'Login Flow', organization_workspace: :test do
|
|
9
9
|
])
|
10
10
|
end
|
11
11
|
|
12
|
-
let!(:user) { create :user, first_name: 'John', last_name: 'Doe', uid: 'johndoe@test.com'
|
12
|
+
let!(:user) { create :user, first_name: 'John', last_name: 'Doe', uid: 'johndoe@test.com' }
|
13
13
|
|
14
14
|
before { reindex_current_organization! }
|
15
15
|
|
@@ -9,11 +9,30 @@ feature 'menu bar' do
|
|
9
9
|
before { private_organization.switch! }
|
10
10
|
|
11
11
|
context 'anonymous user' do
|
12
|
-
|
13
|
-
visit '/'
|
12
|
+
before { set_automatic_login! false }
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
context 'on organization without permissions' do
|
15
|
+
scenario 'should not see menu bar' do
|
16
|
+
visit '/'
|
17
|
+
|
18
|
+
expect(page).not_to have_text('Profile')
|
19
|
+
expect(page).not_to have_text('Classroom')
|
20
|
+
expect(page).not_to have_text('Bibliotheca')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'on organization with permissions' do
|
25
|
+
let(:public_organization) { create(:public_organization, book: book) }
|
26
|
+
before { set_subdomain_host! public_organization.name }
|
27
|
+
before { public_organization.switch! }
|
28
|
+
|
29
|
+
scenario 'should not see menu bar' do
|
30
|
+
visit '/'
|
31
|
+
|
32
|
+
expect(page).not_to have_text('Profile')
|
33
|
+
expect(page).not_to have_text('Classroom')
|
34
|
+
expect(page).not_to have_text('Bibliotheca')
|
35
|
+
end
|
17
36
|
end
|
18
37
|
end
|
19
38
|
|
@@ -23,32 +42,75 @@ feature 'menu bar' do
|
|
23
42
|
let(:teacher) { create(:user, permissions: {student: 'private/*', teacher: 'private/*'}) }
|
24
43
|
let(:writer) { create(:user, permissions: {student: 'private/*', writer: 'private/*'}) }
|
25
44
|
let(:janitor) { create(:user, permissions: {student: 'private/*', janitor: 'private/*'}) }
|
45
|
+
let(:admin) { create(:user, permissions: {student: 'private/*', admin: 'private/*'}) }
|
26
46
|
let(:owner) { create(:user, permissions: {student: 'private/*', owner: 'private/*'}) }
|
27
47
|
|
28
|
-
scenario 'visitor should
|
48
|
+
scenario 'visitor should only see profile' do
|
49
|
+
set_current_user! visitor
|
50
|
+
|
51
|
+
visit '/'
|
52
|
+
expect(page).to have_text('Profile')
|
53
|
+
expect(page).not_to have_text('Classroom')
|
54
|
+
expect(page).not_to have_text('Bibliotheca')
|
55
|
+
end
|
56
|
+
|
57
|
+
scenario 'student should only see profile' do
|
29
58
|
set_current_user! visitor
|
30
59
|
|
31
60
|
visit '/'
|
61
|
+
expect(page).to have_text('Profile')
|
32
62
|
expect(page).not_to have_text('Classroom')
|
33
63
|
expect(page).not_to have_text('Bibliotheca')
|
34
64
|
end
|
35
65
|
|
36
|
-
scenario 'teacher should see classroom' do
|
66
|
+
scenario 'teacher should see profile and classroom' do
|
37
67
|
set_current_user! teacher
|
38
68
|
|
39
69
|
visit '/'
|
40
70
|
|
71
|
+
expect(page).to have_text('Profile')
|
41
72
|
expect(page).to have_text('Classroom')
|
42
73
|
expect(page).not_to have_text('Bibliotheca')
|
43
74
|
end
|
44
75
|
|
45
|
-
scenario 'writer should see bibliotheca' do
|
76
|
+
scenario 'writer should see profile and bibliotheca' do
|
46
77
|
set_current_user! writer
|
47
78
|
|
48
79
|
visit '/'
|
49
80
|
|
81
|
+
expect(page).to have_text('Profile')
|
50
82
|
expect(page).not_to have_text('Classroom')
|
51
83
|
expect(page).to have_text('Bibliotheca')
|
52
84
|
end
|
85
|
+
|
86
|
+
scenario 'janitor should see profile and classroom' do
|
87
|
+
set_current_user! janitor
|
88
|
+
|
89
|
+
visit '/'
|
90
|
+
|
91
|
+
expect(page).to have_text('Profile')
|
92
|
+
expect(page).to have_text('Classroom')
|
93
|
+
expect(page).not_to have_text('Bibliotheca')
|
94
|
+
end
|
95
|
+
|
96
|
+
scenario 'admin should see profile, classroom and bibliotheca' do
|
97
|
+
set_current_user! admin
|
98
|
+
|
99
|
+
visit '/'
|
100
|
+
|
101
|
+
expect(page).to have_text('Profile')
|
102
|
+
expect(page).to have_text('Classroom')
|
103
|
+
expect(page).to have_text('Bibliotheca')
|
104
|
+
end
|
105
|
+
|
106
|
+
scenario 'owner should see profile, classroom and bibliotheca' do
|
107
|
+
set_current_user! owner
|
108
|
+
|
109
|
+
visit '/'
|
110
|
+
|
111
|
+
expect(page).to have_text('Profile')
|
112
|
+
expect(page).to have_text('Classroom')
|
113
|
+
expect(page).to have_text('Bibliotheca')
|
114
|
+
end
|
53
115
|
end
|
54
116
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
feature '
|
4
|
-
let!(:user) { create(:user, uid: 'mumuki@test.com', first_name: nil) }
|
3
|
+
feature 'Profile Flow', organization_workspace: :test do
|
4
|
+
let!(:user) { create(:user, uid: 'mumuki@test.com', first_name: nil, last_name: nil) }
|
5
5
|
let(:haskell) { create(:haskell) }
|
6
6
|
let!(:chapter) {
|
7
7
|
create(:chapter, name: 'Functional Programming', lessons: [
|
@@ -37,21 +37,35 @@ feature 'Standard Flow', organization_workspace: :test do
|
|
37
37
|
visit '/'
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
user
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
context 'user with uncompleted profile' do
|
41
|
+
scenario 'redirect to /user if user has access to organizations' do
|
42
|
+
user.update! permissions: {student: 'test/*'}
|
43
|
+
click_on 'Sign in'
|
44
|
+
expect(page).to have_text('Please complete your profile data to continue!')
|
45
|
+
end
|
46
|
+
|
47
|
+
scenario 'redirect to /user if user does not have access to organizations' do
|
48
|
+
click_on 'Sign in'
|
49
|
+
expect(page).to have_text('Please complete your profile data to continue!')
|
50
|
+
end
|
45
51
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
52
|
+
scenario 'is able to log out' do
|
53
|
+
click_on 'Sign in'
|
54
|
+
set_automatic_login! false
|
55
|
+
|
56
|
+
click_on 'Sign Out'
|
57
|
+
expect(page).to_not have_text('Please complete your profile data to continue!')
|
58
|
+
expect(page).to_not have_text('Sign Out')
|
59
|
+
expect(page).to have_text('Sign In')
|
60
|
+
end
|
50
61
|
end
|
51
62
|
|
52
|
-
|
53
|
-
|
54
|
-
|
63
|
+
context 'user with completed profile' do
|
64
|
+
scenario 'do not redirect to /user' do
|
65
|
+
user.update! first_name: 'Mercedes', last_name: 'Sosa', gender: 0, birthdate: Date.new(1935, 9, 7)
|
66
|
+
click_on 'Sign in'
|
67
|
+
expect(page).not_to have_text('Please complete your profile data to continue!')
|
68
|
+
end
|
55
69
|
end
|
56
70
|
|
57
71
|
context 'logged in user' do
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Runner Assets Flow', organization_workspace: :test do
|
4
|
+
let(:user) { create(:user) }
|
5
|
+
|
6
|
+
let(:haskell) { create(:haskell) }
|
7
|
+
let(:gobstones) { create(:gobstones, layout_shows_loading_content: true, editor_shows_loading_content: true) }
|
8
|
+
let(:bash) { create(:bash, layout_shows_loading_content: true) }
|
9
|
+
|
10
|
+
let(:problem) { build(:problem, name: 'Succ', description: 'Description of Succ', editor: :code, language: gobstones) }
|
11
|
+
let(:problem_2) { build(:problem, name: 'Succ2', description: 'Description of Succ2', editor: :custom, language: gobstones) }
|
12
|
+
let(:problem_3) { build(:problem, name: 'Succ3', description: 'Description of Succ3', editor: :code, language: haskell) }
|
13
|
+
let(:problem_4) { build(:problem, name: 'Succ4', description: 'Description of Succ4', editor: :code, language: bash) }
|
14
|
+
|
15
|
+
let!(:chapter) {
|
16
|
+
create(:chapter, name: 'Functional Programming', lessons: [
|
17
|
+
create(:lesson, name: 'getting-started', description: 'An awesome guide', language: haskell, exercises: [
|
18
|
+
problem, problem_2, problem_3, problem_4
|
19
|
+
])
|
20
|
+
]) }
|
21
|
+
|
22
|
+
before { reindex_current_organization! }
|
23
|
+
before { set_current_user! user }
|
24
|
+
|
25
|
+
context 'loading assets script' do
|
26
|
+
describe 'for language with both editor and layout loader' do
|
27
|
+
scenario 'for exercise with code editor' do
|
28
|
+
visit "/exercises/#{problem.id}"
|
29
|
+
expect(page).to have_selector('#layout-loading-script', visible: false)
|
30
|
+
expect(page).not_to have_selector('#editor-loading-script', visible: false)
|
31
|
+
end
|
32
|
+
|
33
|
+
scenario 'for exercise with custom editor' do
|
34
|
+
visit "/exercises/#{problem_2.id}"
|
35
|
+
expect(page).not_to have_selector('#layout-loading-script', visible: false)
|
36
|
+
expect(page).to have_selector('#editor-loading-script', visible: false)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'for language without assets loader' do
|
41
|
+
scenario 'for exercise with code editor' do
|
42
|
+
visit "/exercises/#{problem_3.id}"
|
43
|
+
expect(page).not_to have_selector('#layout-loading-script', visible: false)
|
44
|
+
expect(page).not_to have_selector('#editor-loading-script', visible: false)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'for language with layout loader' do
|
49
|
+
scenario 'for exercise with code editor' do
|
50
|
+
visit "/exercises/#{problem_4.id}"
|
51
|
+
expect(page).to have_selector('#layout-loading-script', visible: false)
|
52
|
+
expect(page).not_to have_selector('#editor-loading-script', visible: false)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
data/spec/login_helper.rb
CHANGED
@@ -8,7 +8,6 @@ Mumukit::Login.configure do |config|
|
|
8
8
|
config.mucookie_sign_salt = 'mucookie test sign salt'
|
9
9
|
end
|
10
10
|
|
11
|
-
OmniAuth.config.test_mode = true
|
12
11
|
OmniAuth.config.mock_auth[:developer] =
|
13
12
|
OmniAuth::AuthHash.new provider: 'developer',
|
14
13
|
uid: 'johndoe@test.com',
|
@@ -18,3 +17,7 @@ OmniAuth.config.mock_auth[:developer] =
|
|
18
17
|
def set_current_user!(user)
|
19
18
|
allow_any_instance_of(ApplicationController).to receive(:current_user_uid).and_return(user.uid)
|
20
19
|
end
|
20
|
+
|
21
|
+
def set_automatic_login!(test_mode)
|
22
|
+
OmniAuth.config.test_mode = test_mode
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-laboratory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -193,7 +193,9 @@ files:
|
|
193
193
|
- app/assets/images/user_shape.png
|
194
194
|
- app/assets/javascripts/mumuki_laboratory/application.js
|
195
195
|
- app/assets/javascripts/mumuki_laboratory/application/alias-modes.js
|
196
|
+
- app/assets/javascripts/mumuki_laboratory/application/assets-loader.js
|
196
197
|
- app/assets/javascripts/mumuki_laboratory/application/bridge.js
|
198
|
+
- app/assets/javascripts/mumuki_laboratory/application/button.js
|
197
199
|
- app/assets/javascripts/mumuki_laboratory/application/characters.js
|
198
200
|
- app/assets/javascripts/mumuki_laboratory/application/codemirror-builder.js
|
199
201
|
- app/assets/javascripts/mumuki_laboratory/application/codemirror.js
|
@@ -541,6 +543,7 @@ files:
|
|
541
543
|
- spec/features/not_found_public_flow_spec.rb
|
542
544
|
- spec/features/profile_flow_spec.rb
|
543
545
|
- spec/features/progressive_tips_spec.rb
|
546
|
+
- spec/features/runner_assets_spec.rb
|
544
547
|
- spec/features/standard_flow_spec.rb
|
545
548
|
- spec/features/topic_flow_spec.rb
|
546
549
|
- spec/helpers/application_helper_spec.rb
|
@@ -635,6 +638,7 @@ test_files:
|
|
635
638
|
- spec/features/profile_flow_spec.rb
|
636
639
|
- spec/features/topic_flow_spec.rb
|
637
640
|
- spec/features/chapter_spec.rb
|
641
|
+
- spec/features/runner_assets_spec.rb
|
638
642
|
- spec/features/home_private_flow_spec.rb
|
639
643
|
- spec/features/lessons_flow_spec.rb
|
640
644
|
- spec/features/dynamic_exam_spec.rb
|