mumuki-laboratory 5.0.12 → 5.1.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 +339 -0
- data/app/assets/javascripts/application/bridge.js +36 -7
- data/app/assets/javascripts/application/kids.js +92 -7
- data/app/assets/javascripts/application/submission.js +2 -1
- data/app/assets/stylesheets/application/modules/_highlight.scss +8 -0
- data/app/assets/stylesheets/application/modules/_kids.scss +92 -27
- data/app/controllers/api/base_controller.rb +23 -0
- data/app/controllers/api/courses_controller.rb +26 -0
- data/app/controllers/api/organizations_controller.rb +28 -0
- data/app/controllers/api/roles_controller.rb +47 -0
- data/app/controllers/api/students_controller.rb +9 -0
- data/app/controllers/api/teachers_controller.rb +9 -0
- data/app/controllers/api/users_controller.rb +18 -0
- data/app/controllers/assets_controller.rb +2 -1
- data/app/controllers/concerns/on_base_organization_only.rb +11 -0
- data/app/controllers/concerns/organizations_controller_template.rb +34 -0
- data/app/controllers/concerns/users_controller_template.rb +28 -0
- data/app/controllers/concerns/with_api_errors.rb +37 -0
- data/app/controllers/concerns/with_authorization.rb +19 -0
- data/app/controllers/concerns/with_errors_filter.rb +32 -0
- data/app/helpers/reset_button_helper.rb +1 -1
- data/app/models/api_client.rb +27 -0
- data/app/models/api_client_spec.rb +6 -0
- data/app/models/concerns/with_assignments.rb +4 -1
- data/app/models/course.rb +4 -6
- data/app/models/exercise/challenge.rb +5 -6
- data/app/models/language.rb +1 -1
- data/app/models/organization.rb +4 -0
- data/app/models/user.rb +22 -1
- data/app/views/exercise_solutions/_kids_results_button.html.erb +11 -0
- data/app/views/exercise_solutions/_results.html.erb +1 -7
- data/app/views/exercise_solutions/_results_button.html.erb +7 -0
- data/app/views/layouts/_kids.html.erb +5 -2
- data/app/views/layouts/exercise_inputs/editors/_custom.html.erb +1 -0
- data/app/views/layouts/exercise_inputs/forms/_kids_form.html.erb +3 -0
- data/app/views/layouts/exercise_inputs/layouts/_input_kids.html.erb +3 -3
- data/app/views/layouts/modals/_kids_context.html.erb +0 -3
- data/app/views/layouts/modals/_kids_results.html.erb +2 -0
- data/config/routes.rb +23 -0
- data/db/migrate/20180129142749_add_api_client.rb +11 -0
- data/lib/mumuki/laboratory/controllers/results_rendering.rb +7 -1
- data/lib/mumuki/laboratory/extensions/string.rb +8 -0
- data/lib/mumuki/laboratory/locales/en.yml +4 -0
- data/lib/mumuki/laboratory/locales/es.yml +4 -0
- data/lib/mumuki/laboratory/locales/pt.yml +4 -0
- data/lib/mumuki/laboratory/mumukit/auth.rb +7 -0
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/public/amarillo_exito.svg +11 -0
- data/public/amarillo_fracaso.svg +5 -0
- data/public/compass_rose.svg +1417 -0
- data/spec/controllers/api_clients_controller.rb +26 -0
- data/spec/controllers/confirmations_controller_spec.rb +1 -1
- data/spec/controllers/courses_api_controller_spec.rb +28 -0
- data/spec/controllers/exercise_solutions_controller_spec.rb +1 -1
- data/spec/controllers/messages_controller_spec.rb +1 -1
- data/spec/controllers/organizations_api_controller_spec.rb +235 -0
- data/spec/controllers/students_api_controller_spec.rb +101 -0
- data/spec/controllers/users_api_controller_spec.rb +56 -0
- data/spec/dummy/db/schema.rb +9 -0
- data/spec/factories/api_client_factory.rb +18 -0
- data/spec/factories/course_factory.rb +9 -0
- data/spec/features/chapter_spec.rb +1 -1
- data/spec/features/complements_flow_spec.rb +1 -1
- data/spec/features/exams_flow_spec.rb +1 -1
- data/spec/features/exercise_flow_spec.rb +1 -1
- data/spec/features/guide_reset_spec.rb +1 -1
- data/spec/features/guides_flow_spec.rb +1 -1
- data/spec/features/home_public_flow_spec.rb +1 -1
- data/spec/features/lessons_flow_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/profile_flow_spec.rb +1 -1
- data/spec/features/standard_flow_spec.rb +1 -1
- data/spec/helpers/application_helper_spec.rb +1 -1
- data/spec/helpers/email_helper_spec.rb +1 -1
- data/spec/helpers/exercise_input_helper_spec.rb +1 -1
- data/spec/helpers/with_breadcrumbs_spec.rb +1 -1
- data/spec/helpers/with_navigation_spec.rb +1 -1
- data/spec/models/assignment_spec.rb +1 -1
- data/spec/models/book_import_spec.rb +1 -1
- data/spec/models/book_spec.rb +1 -1
- data/spec/models/course_spec.rb +1 -1
- data/spec/models/event_generation_spec.rb +1 -1
- data/spec/models/exam_spec.rb +1 -1
- data/spec/models/exercise_spec.rb +11 -3
- data/spec/models/guide_spec.rb +1 -1
- data/spec/models/interactive_spec.rb +1 -1
- data/spec/models/lesson_spec.rb +1 -1
- data/spec/models/message_spec.rb +1 -1
- data/spec/models/navigation_spec.rb +1 -1
- data/spec/models/organization_spec.rb +1 -1
- data/spec/models/problem_spec.rb +1 -1
- data/spec/models/question_spec.rb +1 -1
- data/spec/models/reading_spec.rb +1 -1
- data/spec/models/solution_spec.rb +1 -1
- data/spec/models/usage_spec.rb +1 -1
- data/spec/models/user_changed_spec.rb +1 -1
- data/spec/models/user_spec.rb +5 -5
- data/spec/spec_helper.rb +19 -3
- metadata +37 -2
data/spec/dummy/db/schema.rb
CHANGED
@@ -15,6 +15,15 @@ ActiveRecord::Schema.define(version: 20180402015405) do
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
17
17
|
|
18
|
+
create_table "api_clients", force: :cascade do |t|
|
19
|
+
t.string "description"
|
20
|
+
t.string "token"
|
21
|
+
t.bigint "user_id"
|
22
|
+
t.datetime "created_at", null: false
|
23
|
+
t.datetime "updated_at", null: false
|
24
|
+
t.index ["user_id"], name: "index_api_clients_on_user_id"
|
25
|
+
end
|
26
|
+
|
18
27
|
create_table "assignments", id: :serial, force: :cascade do |t|
|
19
28
|
t.text "solution"
|
20
29
|
t.integer "exercise_id"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :api_client do |t|
|
3
|
+
transient do
|
4
|
+
role :janitor
|
5
|
+
grant 'test/*'
|
6
|
+
end
|
7
|
+
|
8
|
+
description "foo"
|
9
|
+
user {
|
10
|
+
create :user,
|
11
|
+
first_name: 'foo',
|
12
|
+
last_name: 'bar',
|
13
|
+
email: 'foo+1@bar.com',
|
14
|
+
uid: 'foo+1@bar.com',
|
15
|
+
permissions: { role => grant }
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
feature 'Exams Flow' do
|
3
|
+
feature 'Exams Flow', organization_workspace: :test do
|
4
4
|
let(:exam) { create(:exam, classroom_id: '12345') }
|
5
5
|
let(:other_exam) { create(:exam, organization: other_organization) }
|
6
6
|
let!(:exam_not_in_path) { create :exam }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
feature 'Lessons Flow' do
|
3
|
+
feature 'Lessons 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]) }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
feature 'Login Flow' do
|
3
|
+
feature 'Login Flow', organization_workspace: :test do
|
4
4
|
let!(:chapter) do
|
5
5
|
create(:chapter, name: 'C1', lessons: [
|
6
6
|
create(:lesson, language: create(:language), name: 'awesomeRubyGuide', description: 'rubist baz guide', exercises: [
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
feature 'Standard Flow' do
|
3
|
+
feature 'Standard Flow', organization_workspace: :test do
|
4
4
|
let!(:user) { create(:user, uid: 'mumuki@test.com', first_name: nil) }
|
5
5
|
let!(:user2) { create(:user, uid: 'johndoe@test.com') }
|
6
6
|
let(:haskell) { create(:haskell) }
|
data/spec/models/book_spec.rb
CHANGED
data/spec/models/course_spec.rb
CHANGED
data/spec/models/exam_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Exercise do
|
3
|
+
describe Exercise, organization_workspace: :test do
|
4
4
|
let(:exercise) { create(:exercise) }
|
5
5
|
let(:user) { create(:user) }
|
6
6
|
|
@@ -88,14 +88,22 @@ describe Exercise do
|
|
88
88
|
it { expect(exercise_with_extra.extra).to eq "exercise extra code\n" }
|
89
89
|
end
|
90
90
|
|
91
|
-
context 'when exercise has extra code and
|
91
|
+
context 'when exercise has extra code and belongs to a guide with no extra code' do
|
92
92
|
let!(:exercise_with_extra) { create(:exercise, guide: guide, extra: 'exercise extra code') }
|
93
93
|
let!(:guide) { create(:guide) }
|
94
94
|
|
95
95
|
it { expect(exercise_with_extra.extra).to eq "exercise extra code\n" }
|
96
96
|
end
|
97
97
|
|
98
|
-
context 'when exercise has extra code
|
98
|
+
context 'when exercise has extra code with trailing whitespaces
|
99
|
+
and belongs to a guide with no extra code' do
|
100
|
+
let!(:exercise_with_extra) { create(:exercise, guide: guide, extra: "\nexercise extra code \n") }
|
101
|
+
let!(:guide) { create(:guide) }
|
102
|
+
|
103
|
+
it { expect(exercise_with_extra.extra).to eq "exercise extra code\n" }
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'when exercise has extra code and belongs to a guide with extra code' do
|
99
107
|
let!(:exercise_with_extra) { create(:exercise, guide: guide, extra: 'exercise extra code') }
|
100
108
|
let!(:guide) { create(:guide, extra: 'guide extra code') }
|
101
109
|
|
data/spec/models/guide_spec.rb
CHANGED
data/spec/models/lesson_spec.rb
CHANGED
data/spec/models/message_spec.rb
CHANGED
data/spec/models/problem_spec.rb
CHANGED
data/spec/models/reading_spec.rb
CHANGED
data/spec/models/usage_spec.rb
CHANGED
data/spec/models/user_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe User do
|
3
|
+
describe User, organization_workspace: :test do
|
4
4
|
describe '#clear_progress!' do
|
5
5
|
let(:student) { create :user }
|
6
6
|
let(:more_clauses) { create(:exercise, name: 'More Clauses') }
|
@@ -25,7 +25,7 @@ describe User do
|
|
25
25
|
context 'when final user has less information than original' do
|
26
26
|
let!(:submission) { your_first_program.submit_solution! original, content: 'adasdsadas' }
|
27
27
|
|
28
|
-
before { original.reload.
|
28
|
+
before { original.reload.copy_progress_to! final }
|
29
29
|
|
30
30
|
let(:original) { create :user,
|
31
31
|
permissions: {student: 'codeorga/*'},
|
@@ -54,7 +54,7 @@ describe User do
|
|
54
54
|
|
55
55
|
context 'when final user has more information than original' do
|
56
56
|
before { more_clauses.submit_solution! final, content: 'adasdsadas' }
|
57
|
-
before { original.
|
57
|
+
before { original.copy_progress_to! final.reload }
|
58
58
|
|
59
59
|
let(:original) { create :user,
|
60
60
|
permissions: Mumukit::Auth::Permissions.new,
|
@@ -79,7 +79,7 @@ describe User do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
context 'when both have information, but final is newer' do
|
82
|
-
before { original.
|
82
|
+
before { original.copy_progress_to! final }
|
83
83
|
|
84
84
|
let(:original) { create :user,
|
85
85
|
permissions: {student: 'codeorga/*'},
|
@@ -109,7 +109,7 @@ describe User do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
context 'when both have information, but original is newer' do
|
112
|
-
before { original.
|
112
|
+
before { original.copy_progress_to! final }
|
113
113
|
|
114
114
|
let(:original) { create :user,
|
115
115
|
permissions: {student: 'codeorga/*'},
|