mumuki-laboratory 7.2.0 → 7.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a309d23781b16429c67d4898ec3522ea8cc921c5980a8be22d8c10d29aa74b
|
4
|
+
data.tar.gz: ea53886235870295a9821b84ef509f6a2b50cb20411c4eef368e9a0cd5851bf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa4ac32fd357aae1f45a1e999d49d0d7aca17f3eb183930725cd49bf9c9f86f71c9fd7da25b63313900e98511b27477d8a5b49dc4857487ac3e29a9a7f4b33e0
|
7
|
+
data.tar.gz: 3cf087f36868a799843bfdc651501ab70489cc2671e62c96b2f19578bbe5c07e1db46a00dda4972400db9f1ec3c1c4d438733a1139318282a107f6f567789bd8
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module ContextualizationResultHelper
|
2
2
|
def humanized_expectation_result_item(expectation_result)
|
3
|
-
%Q{<li>#{status_icon(expectation_result[:result])} #{
|
3
|
+
%Q{<li>#{status_icon(expectation_result[:result])} #{humanized_expectation_explanation expectation_result}</li>}.html_safe
|
4
|
+
end
|
5
|
+
|
6
|
+
def humanized_expectation_explanation(expectation_result)
|
7
|
+
sanitized Mumukit::ContentType::Markdown.to_html(expectation_result[:explanation], one_liner: true)
|
4
8
|
end
|
5
9
|
|
6
10
|
def render_feedback?(contextualization)
|
@@ -3,54 +3,81 @@ require 'ostruct'
|
|
3
3
|
|
4
4
|
describe ContextualizationResultHelper do
|
5
5
|
helper IconsHelper
|
6
|
+
helper FontAwesome::Rails::IconHelper
|
6
7
|
helper ContextualizationResultHelper
|
7
8
|
|
8
|
-
let(:html) { render_test_results contextualization }
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
let(:contextualization) { struct(
|
13
|
-
exercise: struct(hidden?: false),
|
14
|
-
test_results: [{title: '2 is 2', status: :passed, result: ''}],
|
15
|
-
output_content_type: Mumukit::ContentType::Plain) }
|
10
|
+
describe 'humanized_expectation_result_item' do
|
11
|
+
let(:html) { humanized_expectation_result_item expectation_result }
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
context 'plain explanation' do
|
14
|
+
let(:expectation_result) { {result: :failed, explanation: 'you must delegate'} }
|
15
|
+
|
16
|
+
it { expect(html).to eq '<li><i class="fa fa-times-circle text-danger status-icon"></i> you must delegate</li>' }
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'html explanation' do
|
21
|
+
let(:expectation_result) { {result: :failed, explanation: 'you must use <strong>if</strong>'} }
|
22
|
+
|
23
|
+
it { expect(html).to eq '<li><i class="fa fa-times-circle text-danger status-icon"></i> you must use <strong>if</strong></li>' }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'markdown explanation' do
|
27
|
+
let(:expectation_result) { {result: :failed, explanation: 'you must call `fooBar`'} }
|
28
|
+
|
29
|
+
it { expect(html).to eq '<li><i class="fa fa-times-circle text-danger status-icon"></i> you must call <code>fooBar</code></li>' }
|
20
30
|
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'render_test_results' do
|
34
|
+
let(:html) { render_test_results contextualization }
|
21
35
|
|
22
|
-
context '
|
23
|
-
context 'when
|
36
|
+
context 'structured results' do
|
37
|
+
context 'when single passed submission' do
|
24
38
|
let(:contextualization) { struct(
|
25
39
|
exercise: struct(hidden?: false),
|
26
|
-
test_results: [{title: '2 is 2', status: :
|
40
|
+
test_results: [{title: '2 is 2', status: :passed, result: ''}],
|
27
41
|
output_content_type: Mumukit::ContentType::Plain) }
|
28
42
|
|
29
|
-
it { expect(html).to
|
30
|
-
it { expect(html).to include "<
|
31
|
-
it { expect(html).to include "
|
43
|
+
it { expect(html).to be_html_safe }
|
44
|
+
it { expect(html).to include "<i class=\"fa fa-check-circle text-success status-icon\"></i>" }
|
45
|
+
it { expect(html).to include "2 is 2" }
|
32
46
|
end
|
33
47
|
|
34
|
-
context 'when
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
48
|
+
context 'when single failed submission' do
|
49
|
+
context 'when plain results' do
|
50
|
+
let(:contextualization) { struct(
|
51
|
+
exercise: struct(hidden?: false),
|
52
|
+
test_results: [{title: '2 is 2', status: :failed, result: 'something _went_ wrong'}],
|
53
|
+
output_content_type: Mumukit::ContentType::Plain) }
|
54
|
+
|
55
|
+
it { expect(html).to include "<i class=\"fa fa-times-circle text-danger status-icon\"></i>" }
|
56
|
+
it { expect(html).to include "<strong class=\"example-title\">2 is 2</strong>" }
|
57
|
+
it { expect(html).to include "<pre>something _went_ wrong</pre>" }
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'when markdown results' do
|
61
|
+
let(:contextualization) { struct(
|
62
|
+
exercise: struct(hidden?: false),
|
63
|
+
test_results: [{title: '2 is 2', status: :failed, result: 'something went _really_ wrong'}],
|
64
|
+
output_content_type: Mumukit::ContentType::Markdown) }
|
39
65
|
|
40
|
-
|
41
|
-
|
42
|
-
|
66
|
+
it { expect(html).to include "<i class=\"fa fa-times-circle text-danger status-icon\"></i>" }
|
67
|
+
it { expect(html).to include "<strong class=\"example-title\">2 is 2</strong>" }
|
68
|
+
it { expect(html).to include "<p>something went <em>really</em> wrong</p>" }
|
69
|
+
end
|
43
70
|
end
|
44
71
|
end
|
45
|
-
end
|
46
72
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
73
|
+
context 'unstructured results' do
|
74
|
+
let(:contextualization) { struct(
|
75
|
+
exercise: struct(hidden?: false),
|
76
|
+
result_html: '<pre>ooops, something went wrong</pre>'.html_safe) }
|
51
77
|
|
52
|
-
|
53
|
-
|
54
|
-
|
78
|
+
it { expect(html).to be_html_safe }
|
79
|
+
it { expect(html).to include '<pre>ooops, something went wrong</pre>' }
|
80
|
+
it { expect(html).to include '<strong>Results:</strong>' }
|
81
|
+
end
|
55
82
|
end
|
56
83
|
end
|
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.
|
4
|
+
version: 7.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '7.7'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mumukit-content-type
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.9'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.9'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: mumuki-styles
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|