qti 0.9.14 → 0.9.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/qti.rb +1 -0
  3. data/lib/qti/v1/models/assessment.rb +17 -4
  4. data/lib/qti/v1/models/assessment_item.rb +4 -0
  5. data/lib/qti/v1/models/base.rb +2 -1
  6. data/lib/qti/v1/models/interactions/base_interaction.rb +36 -0
  7. data/lib/qti/v1/models/interactions/choice_interaction.rb +9 -0
  8. data/lib/qti/v1/models/interactions/fill_blank_interaction.rb +1 -1
  9. data/lib/qti/v1/models/interactions/match_interaction.rb +3 -1
  10. data/lib/qti/v1/models/interactions/numeric_interaction.rb +1 -1
  11. data/lib/qti/v1/models/interactions/string_interaction.rb +3 -2
  12. data/lib/qti/v1/models/stimulus_item.rb +33 -0
  13. data/lib/qti/v2/models/assessment_item.rb +4 -0
  14. data/lib/qti/v2/models/interactions/base_interaction.rb +2 -0
  15. data/lib/qti/version.rb +1 -1
  16. data/spec/fixtures/all_canvas_simple_1.2.xml +1676 -0
  17. data/spec/fixtures/feedback_quiz_1.2.xml +246 -0
  18. data/spec/fixtures/items_1.2/matching_feedback.xml +370 -0
  19. data/spec/fixtures/items_1.2/text.no.question.xml +36 -0
  20. data/spec/lib/qti/v1/models/assessment_item_spec.rb +11 -0
  21. data/spec/lib/qti/v1/models/assessment_spec.rb +187 -13
  22. data/spec/lib/qti/v1/models/interactions/base_interaction_spec.rb +56 -0
  23. data/spec/lib/qti/v1/models/interactions/choice_interaction_spec.rb +12 -0
  24. data/spec/lib/qti/v1/models/interactions/match_interaction_spec.rb +67 -23
  25. data/spec/lib/qti/v1/models/stimulus_item_spec.rb +55 -0
  26. metadata +14 -7
  27. data/spec/gemfiles/nokogiri-1.6.gemfile.lock +0 -149
  28. data/spec/gemfiles/nokogiri-1.8.gemfile.lock +0 -149
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe Qti::V1::Models::StimulusItem do
4
+ let(:ref_node) { double }
5
+ let(:attrs) do
6
+ {
7
+ 'ident' => Struct.new(:value).new('aaaa'),
8
+ 'title' => Struct.new(:value).new('tttt')
9
+ }
10
+ end
11
+ let(:loaded_class) { described_class.new(ref_node) }
12
+
13
+ before do
14
+ allow(ref_node).to receive(:attributes).and_return(attrs)
15
+ end
16
+
17
+ context '#body' do
18
+ context 'presentation node does not exist' do
19
+ before do
20
+ expect(ref_node).to receive(:at_xpath).and_return(nil)
21
+ end
22
+
23
+ it 'returns nil' do
24
+ expect(loaded_class.body).to be_nil
25
+ end
26
+ end
27
+
28
+ context 'presentation node does not exist' do
29
+ let(:presentation) { double }
30
+ let(:mattext) { double }
31
+
32
+ before do
33
+ expect(ref_node).to receive(:at_xpath).and_return(presentation)
34
+ expect(presentation).to receive(:at_xpath).and_return(mattext)
35
+ expect(mattext).to receive(:text).and_return('1234')
36
+ end
37
+
38
+ it 'returns nil' do
39
+ expect(loaded_class.body).to eq('1234')
40
+ end
41
+ end
42
+ end
43
+
44
+ it 'returns correct title' do
45
+ expect(loaded_class.title).to eq('tttt')
46
+ end
47
+
48
+ it 'returns correct identifier' do
49
+ expect(loaded_class.identifier).to eq('aaaa')
50
+ end
51
+
52
+ it 'returns correct stimulus_type' do
53
+ expect(loaded_class.stimulus_type).to eq('text')
54
+ end
55
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qti
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hannah Bottalla
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-16 00:00:00.000000000 Z
12
+ date: 2018-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -315,6 +315,7 @@ files:
315
315
  - lib/qti/v1/models/numerics/scoring_node.rb
316
316
  - lib/qti/v1/models/numerics/within_range.rb
317
317
  - lib/qti/v1/models/scoring_data.rb
318
+ - lib/qti/v1/models/stimulus_item.rb
318
319
  - lib/qti/v2/models/assessment_item.rb
319
320
  - lib/qti/v2/models/assessment_test.rb
320
321
  - lib/qti/v2/models/base.rb
@@ -336,6 +337,8 @@ files:
336
337
  - lib/qti/v2/models/scoring_data.rb
337
338
  - lib/qti/v2/models/stimulus_item.rb
338
339
  - lib/qti/version.rb
340
+ - spec/fixtures/all_canvas_simple_1.2.xml
341
+ - spec/fixtures/feedback_quiz_1.2.xml
339
342
  - spec/fixtures/items_1.2/canvas_multiple_dropdown.xml
340
343
  - spec/fixtures/items_1.2/canvas_multiple_dropdowns.xml
341
344
  - spec/fixtures/items_1.2/canvas_multiple_fib.xml
@@ -347,6 +350,7 @@ files:
347
350
  - spec/fixtures/items_1.2/formula_mform.xml
348
351
  - spec/fixtures/items_1.2/formula_mvar.xml
349
352
  - spec/fixtures/items_1.2/matching.xml
353
+ - spec/fixtures/items_1.2/matching_feedback.xml
350
354
  - spec/fixtures/items_1.2/multiple_answer.xml
351
355
  - spec/fixtures/items_1.2/multiple_answer_canvas.xml
352
356
  - spec/fixtures/items_1.2/multiple_choice.xml
@@ -356,6 +360,7 @@ files:
356
360
  - spec/fixtures/items_1.2/numeric_within_range.xml
357
361
  - spec/fixtures/items_1.2/ordering.xml
358
362
  - spec/fixtures/items_1.2/single_fib.xml
363
+ - spec/fixtures/items_1.2/text.no.question.xml
359
364
  - spec/fixtures/items_1.2/true_false.xml
360
365
  - spec/fixtures/items_1.2/upload.xml
361
366
  - spec/fixtures/items_2.1/Example02-feedbackInline.xml
@@ -559,9 +564,7 @@ files:
559
564
  - spec/fixtures/tests/tests/rtest27.xml
560
565
  - spec/fixtures/unsupported_version/imsmanifest.xml
561
566
  - spec/gemfiles/nokogiri-1.6.gemfile
562
- - spec/gemfiles/nokogiri-1.6.gemfile.lock
563
567
  - spec/gemfiles/nokogiri-1.8.gemfile
564
- - spec/gemfiles/nokogiri-1.8.gemfile.lock
565
568
  - spec/gemfiles/rails-4.2.gemfile
566
569
  - spec/gemfiles/rails-5.0.gemfile
567
570
  - spec/gemfiles/rails-5.1.gemfile
@@ -591,6 +594,7 @@ files:
591
594
  - spec/lib/qti/v1/models/numerics/scoring_base_spec.rb
592
595
  - spec/lib/qti/v1/models/numerics/scoring_node_spec.rb
593
596
  - spec/lib/qti/v1/models/numerics/within_range_spec.rb
597
+ - spec/lib/qti/v1/models/stimulus_item_spec.rb
594
598
  - spec/lib/qti/v2/models/assessment_item_spec.rb
595
599
  - spec/lib/qti/v2/models/assessment_test_spec.rb
596
600
  - spec/lib/qti/v2/models/choices/gap_match_choice_spec.rb
@@ -629,11 +633,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
629
633
  version: '0'
630
634
  requirements: []
631
635
  rubyforge_project:
632
- rubygems_version: 2.6.13
636
+ rubygems_version: 2.6.14
633
637
  signing_key:
634
638
  specification_version: 4
635
639
  summary: QTI 1.2 and 2.1 import and export models
636
640
  test_files:
641
+ - spec/fixtures/all_canvas_simple_1.2.xml
642
+ - spec/fixtures/feedback_quiz_1.2.xml
637
643
  - spec/fixtures/items_1.2/canvas_multiple_dropdown.xml
638
644
  - spec/fixtures/items_1.2/canvas_multiple_dropdowns.xml
639
645
  - spec/fixtures/items_1.2/canvas_multiple_fib.xml
@@ -645,6 +651,7 @@ test_files:
645
651
  - spec/fixtures/items_1.2/formula_mform.xml
646
652
  - spec/fixtures/items_1.2/formula_mvar.xml
647
653
  - spec/fixtures/items_1.2/matching.xml
654
+ - spec/fixtures/items_1.2/matching_feedback.xml
648
655
  - spec/fixtures/items_1.2/multiple_answer.xml
649
656
  - spec/fixtures/items_1.2/multiple_answer_canvas.xml
650
657
  - spec/fixtures/items_1.2/multiple_choice.xml
@@ -654,6 +661,7 @@ test_files:
654
661
  - spec/fixtures/items_1.2/numeric_within_range.xml
655
662
  - spec/fixtures/items_1.2/ordering.xml
656
663
  - spec/fixtures/items_1.2/single_fib.xml
664
+ - spec/fixtures/items_1.2/text.no.question.xml
657
665
  - spec/fixtures/items_1.2/true_false.xml
658
666
  - spec/fixtures/items_1.2/upload.xml
659
667
  - spec/fixtures/items_2.1/Example02-feedbackInline.xml
@@ -857,9 +865,7 @@ test_files:
857
865
  - spec/fixtures/tests/tests/rtest27.xml
858
866
  - spec/fixtures/unsupported_version/imsmanifest.xml
859
867
  - spec/gemfiles/nokogiri-1.6.gemfile
860
- - spec/gemfiles/nokogiri-1.6.gemfile.lock
861
868
  - spec/gemfiles/nokogiri-1.8.gemfile
862
- - spec/gemfiles/nokogiri-1.8.gemfile.lock
863
869
  - spec/gemfiles/rails-4.2.gemfile
864
870
  - spec/gemfiles/rails-5.0.gemfile
865
871
  - spec/gemfiles/rails-5.1.gemfile
@@ -889,6 +895,7 @@ test_files:
889
895
  - spec/lib/qti/v1/models/numerics/scoring_base_spec.rb
890
896
  - spec/lib/qti/v1/models/numerics/scoring_node_spec.rb
891
897
  - spec/lib/qti/v1/models/numerics/within_range_spec.rb
898
+ - spec/lib/qti/v1/models/stimulus_item_spec.rb
892
899
  - spec/lib/qti/v2/models/assessment_item_spec.rb
893
900
  - spec/lib/qti/v2/models/assessment_test_spec.rb
894
901
  - spec/lib/qti/v2/models/choices/gap_match_choice_spec.rb
@@ -1,149 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- mathml2latex (0.1.1)
5
- activesupport (>= 4.2.9, < 5.2)
6
- nokogiri (>= 1.6.8)
7
- qti (0.9.12)
8
- actionview (>= 4.2.0)
9
- activesupport (>= 4.2.9, < 5.2)
10
- dry-struct (~> 0.2.1)
11
- dry-types (~> 0.12.0)
12
- mathml2latex (>= 0.1.0)
13
- nokogiri (>= 1.6.8, < 1.9)
14
- rubyzip (~> 1.2)
15
- sanitize (>= 4.2.0, < 5.0)
16
-
17
- GEM
18
- remote: https://rubygems.org/
19
- specs:
20
- actionview (5.1.5)
21
- activesupport (= 5.1.5)
22
- builder (~> 3.1)
23
- erubi (~> 1.4)
24
- rails-dom-testing (~> 2.0)
25
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
26
- activesupport (5.1.5)
27
- concurrent-ruby (~> 1.0, >= 1.0.2)
28
- i18n (~> 0.7)
29
- minitest (~> 5.1)
30
- tzinfo (~> 1.1)
31
- ast (2.4.0)
32
- builder (3.2.3)
33
- byebug (9.1.0)
34
- coderay (1.1.2)
35
- concurrent-ruby (1.0.5)
36
- crass (1.0.3)
37
- diff-lcs (1.3)
38
- docile (1.3.0)
39
- dry-configurable (0.7.0)
40
- concurrent-ruby (~> 1.0)
41
- dry-container (0.6.0)
42
- concurrent-ruby (~> 1.0)
43
- dry-configurable (~> 0.1, >= 0.1.3)
44
- dry-core (0.4.5)
45
- concurrent-ruby (~> 1.0)
46
- dry-equalizer (0.2.0)
47
- dry-logic (0.4.2)
48
- dry-container (~> 0.2, >= 0.2.6)
49
- dry-core (~> 0.2)
50
- dry-equalizer (~> 0.2)
51
- dry-struct (0.2.1)
52
- dry-configurable (~> 0.1)
53
- dry-equalizer (~> 0.2)
54
- dry-types (~> 0.9, >= 0.9.0)
55
- ice_nine (~> 0.11)
56
- dry-types (0.12.2)
57
- concurrent-ruby (~> 1.0)
58
- dry-configurable (~> 0.1)
59
- dry-container (~> 0.3)
60
- dry-core (~> 0.2, >= 0.2.1)
61
- dry-equalizer (~> 0.2)
62
- dry-logic (~> 0.4, >= 0.4.2)
63
- inflecto (~> 0.0.0, >= 0.0.2)
64
- erubi (1.7.1)
65
- i18n (0.9.5)
66
- concurrent-ruby (~> 1.0)
67
- ice_nine (0.11.2)
68
- inflecto (0.0.2)
69
- json (2.1.0)
70
- loofah (2.2.2)
71
- crass (~> 1.0.2)
72
- nokogiri (>= 1.5.9)
73
- method_source (0.9.0)
74
- mini_portile2 (2.1.0)
75
- minitest (5.11.3)
76
- nokogiri (1.6.8.1)
77
- mini_portile2 (~> 2.1.0)
78
- nokogumbo (1.5.0)
79
- nokogiri
80
- parallel (1.12.1)
81
- parser (2.5.0.5)
82
- ast (~> 2.4.0)
83
- powerpack (0.1.1)
84
- pry (0.11.3)
85
- coderay (~> 1.1.0)
86
- method_source (~> 0.9.0)
87
- rails-dom-testing (2.0.3)
88
- activesupport (>= 4.2.0)
89
- nokogiri (>= 1.6)
90
- rails-html-sanitizer (1.0.4)
91
- loofah (~> 2.2, >= 2.2.2)
92
- rainbow (2.2.2)
93
- rake
94
- rake (0.9.6)
95
- rspec (3.7.0)
96
- rspec-core (~> 3.7.0)
97
- rspec-expectations (~> 3.7.0)
98
- rspec-mocks (~> 3.7.0)
99
- rspec-core (3.7.1)
100
- rspec-support (~> 3.7.0)
101
- rspec-expectations (3.7.0)
102
- diff-lcs (>= 1.2.0, < 2.0)
103
- rspec-support (~> 3.7.0)
104
- rspec-mocks (3.7.0)
105
- diff-lcs (>= 1.2.0, < 2.0)
106
- rspec-support (~> 3.7.0)
107
- rspec-support (3.7.1)
108
- rubocop (0.50.0)
109
- parallel (~> 1.10)
110
- parser (>= 2.3.3.1, < 3.0)
111
- powerpack (~> 0.1)
112
- rainbow (>= 2.2.2, < 3.0)
113
- ruby-progressbar (~> 1.7)
114
- unicode-display_width (~> 1.0, >= 1.0.1)
115
- ruby-progressbar (1.9.0)
116
- rubyzip (1.2.1)
117
- sanitize (4.6.4)
118
- crass (~> 1.0.2)
119
- nokogiri (>= 1.4.4)
120
- nokogumbo (~> 1.4)
121
- simplecov (0.16.1)
122
- docile (~> 1.1)
123
- json (>= 1.8, < 3)
124
- simplecov-html (~> 0.10.0)
125
- simplecov-html (0.10.2)
126
- thread_safe (0.3.6)
127
- tzinfo (1.2.5)
128
- thread_safe (~> 0.1)
129
- unicode-display_width (1.3.0)
130
- wwtd (1.3.0)
131
-
132
- PLATFORMS
133
- ruby
134
-
135
- DEPENDENCIES
136
- bundler (~> 1.15)
137
- byebug (~> 9.0)
138
- nokogiri (~> 1.6.8)
139
- pry (~> 0)
140
- qti!
141
- rake (~> 0)
142
- rspec (~> 3.6)
143
- rspec-mocks (~> 3.6)
144
- rubocop (~> 0.50.0)
145
- simplecov (~> 0)
146
- wwtd (~> 1.3)
147
-
148
- BUNDLED WITH
149
- 1.16.1
@@ -1,149 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- mathml2latex (0.1.2)
5
- activesupport (>= 4.2.9, < 5.2)
6
- nokogiri (>= 1.6.8)
7
- qti (0.9.13)
8
- actionview (>= 4.2.0)
9
- activesupport (>= 4.2.9, < 5.2)
10
- dry-struct (~> 0.2.1)
11
- dry-types (~> 0.12.0)
12
- mathml2latex (>= 0.1.0)
13
- nokogiri (>= 1.6.8, < 1.9)
14
- rubyzip (~> 1.2)
15
- sanitize (>= 4.2.0, < 5.0)
16
-
17
- GEM
18
- remote: https://rubygems.org/
19
- specs:
20
- actionview (5.1.5)
21
- activesupport (= 5.1.5)
22
- builder (~> 3.1)
23
- erubi (~> 1.4)
24
- rails-dom-testing (~> 2.0)
25
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
26
- activesupport (5.1.5)
27
- concurrent-ruby (~> 1.0, >= 1.0.2)
28
- i18n (~> 0.7)
29
- minitest (~> 5.1)
30
- tzinfo (~> 1.1)
31
- ast (2.4.0)
32
- builder (3.2.3)
33
- byebug (9.1.0)
34
- coderay (1.1.2)
35
- concurrent-ruby (1.0.5)
36
- crass (1.0.3)
37
- diff-lcs (1.3)
38
- docile (1.3.0)
39
- dry-configurable (0.7.0)
40
- concurrent-ruby (~> 1.0)
41
- dry-container (0.6.0)
42
- concurrent-ruby (~> 1.0)
43
- dry-configurable (~> 0.1, >= 0.1.3)
44
- dry-core (0.4.5)
45
- concurrent-ruby (~> 1.0)
46
- dry-equalizer (0.2.0)
47
- dry-logic (0.4.2)
48
- dry-container (~> 0.2, >= 0.2.6)
49
- dry-core (~> 0.2)
50
- dry-equalizer (~> 0.2)
51
- dry-struct (0.2.1)
52
- dry-configurable (~> 0.1)
53
- dry-equalizer (~> 0.2)
54
- dry-types (~> 0.9, >= 0.9.0)
55
- ice_nine (~> 0.11)
56
- dry-types (0.12.2)
57
- concurrent-ruby (~> 1.0)
58
- dry-configurable (~> 0.1)
59
- dry-container (~> 0.3)
60
- dry-core (~> 0.2, >= 0.2.1)
61
- dry-equalizer (~> 0.2)
62
- dry-logic (~> 0.4, >= 0.4.2)
63
- inflecto (~> 0.0.0, >= 0.0.2)
64
- erubi (1.7.1)
65
- i18n (0.9.5)
66
- concurrent-ruby (~> 1.0)
67
- ice_nine (0.11.2)
68
- inflecto (0.0.2)
69
- json (2.1.0)
70
- loofah (2.2.2)
71
- crass (~> 1.0.2)
72
- nokogiri (>= 1.5.9)
73
- method_source (0.9.0)
74
- mini_portile2 (2.3.0)
75
- minitest (5.11.3)
76
- nokogiri (1.8.2)
77
- mini_portile2 (~> 2.3.0)
78
- nokogumbo (1.5.0)
79
- nokogiri
80
- parallel (1.12.1)
81
- parser (2.5.0.5)
82
- ast (~> 2.4.0)
83
- powerpack (0.1.1)
84
- pry (0.11.3)
85
- coderay (~> 1.1.0)
86
- method_source (~> 0.9.0)
87
- rails-dom-testing (2.0.3)
88
- activesupport (>= 4.2.0)
89
- nokogiri (>= 1.6)
90
- rails-html-sanitizer (1.0.4)
91
- loofah (~> 2.2, >= 2.2.2)
92
- rainbow (2.2.2)
93
- rake
94
- rake (0.9.6)
95
- rspec (3.7.0)
96
- rspec-core (~> 3.7.0)
97
- rspec-expectations (~> 3.7.0)
98
- rspec-mocks (~> 3.7.0)
99
- rspec-core (3.7.1)
100
- rspec-support (~> 3.7.0)
101
- rspec-expectations (3.7.0)
102
- diff-lcs (>= 1.2.0, < 2.0)
103
- rspec-support (~> 3.7.0)
104
- rspec-mocks (3.7.0)
105
- diff-lcs (>= 1.2.0, < 2.0)
106
- rspec-support (~> 3.7.0)
107
- rspec-support (3.7.1)
108
- rubocop (0.50.0)
109
- parallel (~> 1.10)
110
- parser (>= 2.3.3.1, < 3.0)
111
- powerpack (~> 0.1)
112
- rainbow (>= 2.2.2, < 3.0)
113
- ruby-progressbar (~> 1.7)
114
- unicode-display_width (~> 1.0, >= 1.0.1)
115
- ruby-progressbar (1.9.0)
116
- rubyzip (1.2.1)
117
- sanitize (4.6.4)
118
- crass (~> 1.0.2)
119
- nokogiri (>= 1.4.4)
120
- nokogumbo (~> 1.4)
121
- simplecov (0.16.1)
122
- docile (~> 1.1)
123
- json (>= 1.8, < 3)
124
- simplecov-html (~> 0.10.0)
125
- simplecov-html (0.10.2)
126
- thread_safe (0.3.6)
127
- tzinfo (1.2.5)
128
- thread_safe (~> 0.1)
129
- unicode-display_width (1.3.0)
130
- wwtd (1.3.0)
131
-
132
- PLATFORMS
133
- ruby
134
-
135
- DEPENDENCIES
136
- bundler (~> 1.15)
137
- byebug (~> 9.0)
138
- nokogiri (~> 1.8.1)
139
- pry (~> 0)
140
- qti!
141
- rake (~> 0)
142
- rspec (~> 3.6)
143
- rspec-mocks (~> 3.6)
144
- rubocop (~> 0.50.0)
145
- simplecov (~> 0)
146
- wwtd (~> 1.3)
147
-
148
- BUNDLED WITH
149
- 1.16.1