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: a38780814278c34989e9d89e4ef78364eb0b5e8ccca49e772414fe7e0b02c166
4
- data.tar.gz: 37e8c5cb9a0cc951b83f1905e2d7b309896a24fc2d839935c30676c3360cce2a
3
+ metadata.gz: 34a309d23781b16429c67d4898ec3522ea8cc921c5980a8be22d8c10d29aa74b
4
+ data.tar.gz: ea53886235870295a9821b84ef509f6a2b50cb20411c4eef368e9a0cd5851bf8
5
5
  SHA512:
6
- metadata.gz: 6c8f2296e19c21428a37d6e46abdba9e19dab518b262a149c8de6bc66d3bf9aabb84baeed171cc7aed3b1ac5e706355d46bf9200da4e4f6791a4d202891156ff
7
- data.tar.gz: 87708300550f167df2bbba5f50ab9bec08e60b5513f38d7f7af9121b8391ae432b974151b913d89aa93956ffeff7dc331f7a81973a1f187a8cc36730fc7ea0a3
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])} #{sanitized expectation_result[:explanation]}</li>}.html_safe
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)
@@ -4,6 +4,8 @@
4
4
  <div class="modal-header">
5
5
  <h4 class="text-center">
6
6
  <strong><%= "#{exercise.number}. #{exercise.name}" %></strong>
7
+ <%= teacher_info_button exercise %>
8
+ <%= link_to_bibliotheca_exercise exercise %>
7
9
  </h4>
8
10
  </div>
9
11
  <div class="modal-body">
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Laboratory
3
- VERSION = '7.2.0'
3
+ VERSION = '7.3.0'
4
4
  end
5
5
  end
@@ -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
- context 'structured results' do
11
- context 'when single passed submission' do
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
- it { expect(html).to be_html_safe }
18
- it { expect(html).to include "<i class=\"fa fa-check-circle text-success status-icon\"></i>" }
19
- it { expect(html).to include "2 is 2" }
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 'when single failed submission' do
23
- context 'when plain results' do
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: :failed, result: 'something _went_ wrong'}],
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 include "<i class=\"fa fa-times-circle text-danger status-icon\"></i>" }
30
- it { expect(html).to include "<strong class=\"example-title\">2 is 2</strong>" }
31
- it { expect(html).to include "<pre>something _went_ wrong</pre>" }
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 markdown results' do
35
- let(:contextualization) { struct(
36
- exercise: struct(hidden?: false),
37
- test_results: [{title: '2 is 2', status: :failed, result: 'something went _really_ wrong'}],
38
- output_content_type: Mumukit::ContentType::Markdown) }
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
- it { expect(html).to include "<i class=\"fa fa-times-circle text-danger status-icon\"></i>" }
41
- it { expect(html).to include "<strong class=\"example-title\">2 is 2</strong>" }
42
- it { expect(html).to include "<p>something went <em>really</em> wrong</p>" }
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
- context 'unstructured results' do
48
- let(:contextualization) { struct(
49
- exercise: struct(hidden?: false),
50
- result_html: '<pre>ooops, something went wrong</pre>'.html_safe) }
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
- it { expect(html).to be_html_safe }
53
- it { expect(html).to include '<pre>ooops, something went wrong</pre>' }
54
- it { expect(html).to include '<strong>Results:</strong>' }
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.2.0
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-03-05 00:00:00.000000000 Z
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