mumuki-laboratory 6.0.1 → 6.0.2
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/application/free-form.js +1 -1
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/dummy/db/schema.rb +3 -2
- data/spec/features/exercise_flow_spec.rb +1 -1
- data/spec/helpers/with_choices_spec.rb +1 -1
- data/spec/models/exercise_spec.rb +24 -0
- data/spec/models/guide_import_spec.rb +3 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b3fa503272dae9b4a52b2b427be8a8296cbd07828894bc8c6b61a1e7fabf079
|
4
|
+
data.tar.gz: b07ce7cd4a60d3890ac3900529723c4a6767d5f4f7580c42265ba9752cf4d546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59fb438763ff9aa7d8f69ec71da68d512dcc0b6a01ab5095748e572f6936298667c23b261c19449e19ab70d75458417ef65316aa497847fb3b3a64a782288034
|
7
|
+
data.tar.gz: d65215e6d5a632e53126ac55145b162578e2f54a3f646ace984f4298464e51f05d8dcef2bb6a1da0049741daaa10f6bba673e73f7aa865c63a2ac898edf258dc
|
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: 20181121165956) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
@@ -158,7 +158,7 @@ ActiveRecord::Schema.define(version: 20181117190241) do
|
|
158
158
|
t.boolean "new_expectations", default: false
|
159
159
|
t.boolean "manual_evaluation", default: false
|
160
160
|
t.integer "editor", default: 0, null: false
|
161
|
-
t.string "
|
161
|
+
t.string "choice_values", default: [], null: false, array: true
|
162
162
|
t.text "goal"
|
163
163
|
t.string "initial_state"
|
164
164
|
t.string "final_state"
|
@@ -166,6 +166,7 @@ ActiveRecord::Schema.define(version: 20181117190241) do
|
|
166
166
|
t.text "randomizations"
|
167
167
|
t.text "free_form_editor_source"
|
168
168
|
t.text "teacher_info"
|
169
|
+
t.text "choices"
|
169
170
|
t.index ["guide_id"], name: "index_exercises_on_guide_id"
|
170
171
|
t.index ["language_id"], name: "index_exercises_on_language_id"
|
171
172
|
end
|
@@ -12,7 +12,7 @@ feature 'Exercise Flow', organization_workspace: :test do
|
|
12
12
|
let!(:problem_4) { build(:problem, name: 'Succ4', description: 'Description of Succ4', layout: :input_bottom, extra: 'x = 2') }
|
13
13
|
let!(:problem_5) { build(:problem, name: 'Succ5', description: 'Description of Succ5', layout: :input_right, editor: :upload, hint: 'lele', language: gobstones) }
|
14
14
|
let!(:problem_6) { build(:problem, name: 'Succ6', description: 'Description of Succ6', layout: :input_right, editor: :hidden, language: haskell) }
|
15
|
-
let!(:problem_7) { build(:problem, name: 'Succ7', description: 'Description of Succ7', choices: ['some choice']) }
|
15
|
+
let!(:problem_7) { build(:problem, name: 'Succ7', description: 'Description of Succ7', choices: [{value: 'some choice', checked: true}]) }
|
16
16
|
let!(:playground_1) { build(:playground, name: 'Succ5', description: 'Description of Succ4', layout: :input_right) }
|
17
17
|
let!(:playground_2) { build(:playground, name: 'Succ6', description: 'Description of Succ4', layout: :input_right, extra: 'x = 4') }
|
18
18
|
let!(:reading) { build(:reading, name: 'Reading about Succ', description: 'Lets understand succ history') }
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe ChoicesHelper do
|
4
4
|
helper ChoicesHelper
|
5
5
|
|
6
|
-
context 'exercise
|
6
|
+
context 'exercise with choices' do
|
7
7
|
let(:checked_content) { struct id: '1', index: 0, value: 'foo', text: 'bar' }
|
8
8
|
let(:unchecked_content) { struct id: '3', index: 2, value: 'baz', text: 'lorem' }
|
9
9
|
let(:content) { '0:1' }
|
@@ -4,6 +4,30 @@ describe Exercise, organization_workspace: :test do
|
|
4
4
|
let(:exercise) { create(:exercise) }
|
5
5
|
let(:user) { create(:user, first_name: 'Orlo') }
|
6
6
|
|
7
|
+
describe '#choice_values' do
|
8
|
+
context 'when choices are in 5.0 format' do
|
9
|
+
let(:choice_values) { %w(1492 1453 1773) }
|
10
|
+
let(:exercise) { build(:exercise, description: 'when did byzantine empire fall?', choice_values: choice_values) }
|
11
|
+
|
12
|
+
it { expect(exercise.choices).to be_blank }
|
13
|
+
it { expect(exercise[:choice_values]).to eq choice_values }
|
14
|
+
it { expect(exercise.choice_values).to eq choice_values }
|
15
|
+
it { expect(exercise.choice_index_for '1492').to eq 0 }
|
16
|
+
it { expect(exercise.choice_index_for '1773').to eq 2 }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when choices are in 6.0 format' do
|
20
|
+
let(:choices) { [{value: '1492', checked: false}, {value: '1453', checked: true}, {value: '1773', checked: false}] }
|
21
|
+
let(:exercise) { build(:exercise, description: 'when did byzantine empire fall?', choices: choices) }
|
22
|
+
|
23
|
+
it { expect(exercise.choices).to eq choices }
|
24
|
+
it { expect(exercise[:choice_values]).to be_blank }
|
25
|
+
it { expect(exercise.choice_values).to eq %w(1492 1453 1773) }
|
26
|
+
it { expect(exercise.choice_index_for '1492').to eq 0 }
|
27
|
+
it { expect(exercise.choice_index_for '1773').to eq 2 }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
7
31
|
describe '#slug' do
|
8
32
|
let(:guide) { create(:guide, slug: 'foo/bar') }
|
9
33
|
let(:exercise) { create(:exercise, guide: guide, bibliotheca_id: 4) }
|
@@ -55,7 +55,7 @@ describe Guide do
|
|
55
55
|
extra: '',
|
56
56
|
language: { name: 'text' },
|
57
57
|
test: "---\nequal: '1'\n",
|
58
|
-
choices: [{value: 'foo', checked: false}, {value: 'bar',
|
58
|
+
choices: [{value: 'foo', checked: false}, {value: 'bar', checked: true}],
|
59
59
|
extra_visible: false,
|
60
60
|
id: 8},
|
61
61
|
{type: 'reading',
|
@@ -148,7 +148,8 @@ describe Guide do
|
|
148
148
|
it { expect(guide.exercises.second.language).to eq haskell }
|
149
149
|
it { expect(guide.exercises.second.default_content).to eq 'a default content' }
|
150
150
|
it { expect(guide.exercises.second.extra_visible).to be true }
|
151
|
-
it { expect(guide.exercises.fourth.choices).to eq ['foo', 'bar'] }
|
151
|
+
it { expect(guide.exercises.fourth.choices).to eq [{'value' => 'foo', 'checked' => false}, {'value' => 'bar', 'checked' => true}] }
|
152
|
+
it { expect(guide.exercises.fourth.choice_values).to eq ['foo', 'bar'] }
|
152
153
|
|
153
154
|
it { expect(guide.exercises.third.expectations.first['binding']).to eq 'foo' }
|
154
155
|
|
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: 6.0.
|
4
|
+
version: 6.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 6.0.
|
33
|
+
version: 6.0.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 6.0.
|
40
|
+
version: 6.0.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mumukit-login
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|