qti 2.4.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,146 @@
1
+ describe Qti::V1::Models::Interactions::BaseFillBlankInteraction do
2
+ let(:fixtures_path) { File.join('spec', 'fixtures', 'items_1.2') }
3
+ let(:test_object) { Qti::V1::Models::Assessment.from_path!(file_path) }
4
+ let(:assessment_item_refs) { test_object.assessment_items }
5
+ let(:loaded_class) { described_class.new(assessment_item_refs.first, test_object) }
6
+
7
+ shared_examples_for 'canvas_fib_responses' do
8
+ it 'returns the canvas_fib_responses' do
9
+ expect(loaded_class.canvas_fib_responses).to eq(expected_blanks)
10
+ end
11
+ end
12
+
13
+ context 'canvas_multiple_dropdowns.xml' do
14
+ let(:file_path) { File.join(fixtures_path, 'canvas_multiple_dropdowns.xml') }
15
+ let(:expected_blanks) do
16
+ [
17
+ {
18
+ id: 'response_color1',
19
+ choices:
20
+ [
21
+ { id: '6548', position: 2, item_body: 'red' },
22
+ { id: '5550', position: 3, item_body: 'plaid' }
23
+ ]
24
+ },
25
+ {
26
+ id: 'response_color2',
27
+ choices:
28
+ [
29
+ { id: '6951', position: 2, item_body: 'blue' },
30
+ { id: '4500', position: 3, item_body: 'paisely' }
31
+ ]
32
+ }
33
+ ]
34
+ end
35
+
36
+ include_examples 'canvas_fib_responses'
37
+ end
38
+
39
+ context 'canvas_multiple_fib.xml' do
40
+ let(:file_path) { File.join(fixtures_path, 'canvas_multiple_fib.xml') }
41
+ let(:expected_blanks) do
42
+ [
43
+ {
44
+ id: 'response_color1',
45
+ choices:
46
+ [
47
+ { id: '9799', item_body: 'red', position: 2 },
48
+ { id: '5231', item_body: 'Red', position: 3 }
49
+ ]
50
+ },
51
+ {
52
+ id: 'response_color2',
53
+ choices:
54
+ [
55
+ { id: '5939', item_body: 'blue', position: 2 },
56
+ { id: '6364', item_body: 'Blue', position: 3 }
57
+ ]
58
+ }
59
+ ]
60
+ end
61
+
62
+ include_examples 'canvas_fib_responses'
63
+ end
64
+
65
+ context 'canvas multiple fill in the blank questions with a single blank' do
66
+ let(:file_path) { File.join(fixtures_path, 'canvas_multiple_fib_as_single.xml') }
67
+ let(:expected_blanks) do
68
+ [
69
+ {
70
+ id: 'response_word',
71
+ choices:
72
+ [
73
+ { id: '3537', item_body: 'word', position: 2 }
74
+ ]
75
+ }
76
+ ]
77
+ end
78
+
79
+ include_examples 'canvas_fib_responses'
80
+ end
81
+
82
+ context 'canvas multiple fill in the blank questions with a single blank' do
83
+ let(:file_path) { File.join(fixtures_path, 'canvas_multiple_fib_extra_brackets.xml') }
84
+ let(:expected_blanks) do
85
+ [
86
+ {
87
+ id: 'response_1',
88
+ choices:
89
+ [
90
+ { id: '8464', item_body: 'A', position: 2 },
91
+ { id: '265', item_body: 'B', position: 3 },
92
+ { id: '3002', item_body: 'C', position: 4 },
93
+ { id: '1356', item_body: 'D', position: 5 },
94
+ { id: '5614', item_body: 'E', position: 6 }
95
+ ]
96
+ },
97
+ {
98
+ id: 'response_2',
99
+ choices:
100
+ [
101
+ { id: '4002', item_body: 'A', position: 2 },
102
+ { id: '8630', item_body: 'B', position: 3 },
103
+ { id: '7844', item_body: 'C', position: 4 },
104
+ { id: '3602', item_body: 'D', position: 5 },
105
+ { id: '9525', item_body: 'E', position: 6 }
106
+ ]
107
+ },
108
+ {
109
+ id: 'response_3',
110
+ choices:
111
+ [
112
+ { id: '8390', item_body: 'A', position: 2 },
113
+ { id: '8745', item_body: 'B', position: 3 },
114
+ { id: '3760', item_body: 'C', position: 4 },
115
+ { id: '7542', item_body: 'D', position: 5 },
116
+ { id: '1523', item_body: 'E', position: 6 }
117
+ ]
118
+ },
119
+ {
120
+ id: 'response_4',
121
+ choices:
122
+ [
123
+ { id: '3317', item_body: 'A', position: 2 },
124
+ { id: '6768', item_body: 'B', position: 3 },
125
+ { id: '5823', item_body: 'C', position: 4 },
126
+ { id: '2492', item_body: 'D', position: 5 },
127
+ { id: '4494', item_body: 'E', position: 6 }
128
+ ]
129
+ },
130
+ {
131
+ id: 'response_5',
132
+ choices:
133
+ [
134
+ { id: '6742', item_body: 'A', position: 2 },
135
+ { id: '794', item_body: 'B', position: 3 },
136
+ { id: '4259', item_body: 'C', position: 4 },
137
+ { id: '4851', item_body: 'D', position: 5 },
138
+ { id: '8574', item_body: 'E', position: 6 }
139
+ ]
140
+ }
141
+ ]
142
+ end
143
+
144
+ include_examples 'canvas_fib_responses'
145
+ end
146
+ end
@@ -10,12 +10,6 @@ describe Qti::V1::Models::Interactions::CanvasMultipleDropdownInteraction do
10
10
  end
11
11
  end
12
12
 
13
- shared_examples_for 'blanks' do
14
- it 'returns the blanks' do
15
- expect(loaded_class.blanks).to eq(expected_blanks)
16
- end
17
- end
18
-
19
13
  shared_examples_for 'answers' do
20
14
  it 'returns the answers' do
21
15
  expect(loaded_class.answers.count).to eq answer_count
@@ -47,26 +41,6 @@ describe Qti::V1::Models::Interactions::CanvasMultipleDropdownInteraction do
47
41
  { id: '6951', position: 2, item_body: 'blue' }
48
42
  ]
49
43
  end
50
- let(:expected_blanks) do
51
- [
52
- {
53
- id: 'response_color1',
54
- choices:
55
- [
56
- { id: '6548', position: 2, item_body: 'red' },
57
- { id: '5550', position: 3, item_body: 'plaid' }
58
- ]
59
- },
60
- {
61
- id: 'response_color2',
62
- choices:
63
- [
64
- { id: '6951', position: 2, item_body: 'blue' },
65
- { id: '4500', position: 3, item_body: 'paisely' }
66
- ]
67
- }
68
- ]
69
- end
70
44
  let(:expected_stem_items) do
71
45
  [
72
46
  { id: 'stem_0', position: 1, type: 'text', value: '<div><p>Roses are ' },
@@ -97,7 +71,6 @@ describe Qti::V1::Models::Interactions::CanvasMultipleDropdownInteraction do
97
71
 
98
72
  include_examples 'shuffled?'
99
73
  include_examples 'answers'
100
- include_examples 'blanks'
101
74
  include_examples 'stem_items'
102
75
  include_examples 'scoring_data_structs'
103
76
  end
@@ -1,4 +1,20 @@
1
1
  describe Qti::V1::Models::ObjectBank do
2
+ let(:doc) do
3
+ <<~XML
4
+ <?xml version="1.0" encoding="UTF-8"?>
5
+ <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
6
+ <objectbank ident="gooblegobble12345">
7
+ <qtimetadata>
8
+ <qtimetadatafield>
9
+ <fieldlabel>not_a_bank_title</fieldlabel>
10
+ <fieldentry>A different metadata entry</fieldentry>
11
+ </qtimetadatafield>
12
+ </qtimetadata>
13
+ </objectbank>
14
+ </questestinterop>
15
+ XML
16
+ end
17
+
2
18
  describe 'bank loading' do
3
19
  [
4
20
  'gf3edf8167be16b3a65a00ca923132b07.xml.qti',
@@ -19,21 +35,17 @@ describe Qti::V1::Models::ObjectBank do
19
35
 
20
36
  describe '#title' do
21
37
  it 'missing bank_title defaults to filename' do
22
- allow(File).to receive(:read).and_return(<<~XML)
23
- <?xml version="1.0" encoding="UTF-8"?>
24
- <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
25
- <objectbank ident="gooblegobble12345">
26
- <qtimetadata>
27
- <qtimetadatafield>
28
- <fieldlabel>not_a_bank_title</fieldlabel>
29
- <fieldentry>A different metadata entry</fieldentry>
30
- </qtimetadatafield>
31
- </qtimetadata>
32
- </objectbank>
33
- </questestinterop>
34
- XML
38
+ allow(File).to receive(:read).and_return(doc)
35
39
  objectbank = described_class.new path: '/etc/FakeBank007.xml'
36
40
  expect(objectbank.title).to eq 'FakeBank007'
37
41
  end
38
42
  end
43
+
44
+ describe '#identifier' do
45
+ it 'has the identifier attribute' do
46
+ allow(File).to receive(:read).and_return(doc)
47
+ objectbank = described_class.new path: '/etc/FakeBank008.xml'
48
+ expect(objectbank.identifier).to eq 'gooblegobble12345'
49
+ end
50
+ end
39
51
  end
@@ -15,6 +15,10 @@ describe Qti::V2::Models::AssessmentTest do
15
15
  expect(loaded_class.title).to eq 'Simple Feedback Test'
16
16
  end
17
17
 
18
+ it 'has the identifier' do
19
+ expect(loaded_class.identifier).to eq 'SPECTATUS-GENERATED-TEST'
20
+ end
21
+
18
22
  it 'gets dependency file refs' do
19
23
  refs = loaded_class.assessment_items
20
24
  expect(refs.all? { |ref| File.extname(ref[:path]) == '.xml' })
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: 2.4.0
4
+ version: 2.6.0
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: 2020-05-21 00:00:00.000000000 Z
12
+ date: 2021-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -356,6 +356,7 @@ files:
356
356
  - spec/fixtures/items_1.2/canvas_multiple_dropdowns.xml
357
357
  - spec/fixtures/items_1.2/canvas_multiple_fib.xml
358
358
  - spec/fixtures/items_1.2/canvas_multiple_fib_as_single.xml
359
+ - spec/fixtures/items_1.2/canvas_multiple_fib_extra_brackets.xml
359
360
  - spec/fixtures/items_1.2/choice.xml
360
361
  - spec/fixtures/items_1.2/essay.xml
361
362
  - spec/fixtures/items_1.2/fib.xml
@@ -613,11 +614,8 @@ files:
613
614
  - spec/fixtures/with_banks/non_cc_assessments/gab22de457404cb5cf022078f1e4da75e.xml.qti
614
615
  - spec/fixtures/with_banks/non_cc_assessments/gf3edf8167be16b3a65a00ca923132b07.xml.qti
615
616
  - spec/gemfiles/rails-5.1.gemfile
616
- - spec/gemfiles/rails-5.1.gemfile.lock
617
617
  - spec/gemfiles/rails-5.2.gemfile
618
- - spec/gemfiles/rails-5.2.gemfile.lock
619
618
  - spec/gemfiles/rails-6.0.gemfile
620
- - spec/gemfiles/rails-6.0.gemfile.lock
621
619
  - spec/lib/qti/assessment_item_exporter_spec.rb
622
620
  - spec/lib/qti/exporter_spec.rb
623
621
  - spec/lib/qti/models/assessment_meta_spec.rb
@@ -629,6 +627,7 @@ files:
629
627
  - spec/lib/qti/v1/models/assessment_spec.rb
630
628
  - spec/lib/qti/v1/models/choices/fill_blank_choice_spec.rb
631
629
  - spec/lib/qti/v1/models/choices/logical_identifier_choice_spec.rb
630
+ - spec/lib/qti/v1/models/interactions/base_fill_blank_interaction_spec.rb
632
631
  - spec/lib/qti/v1/models/interactions/base_interaction_spec.rb
633
632
  - spec/lib/qti/v1/models/interactions/canvas_multiple_dropdown_spec.rb
634
633
  - spec/lib/qti/v1/models/interactions/choice_interaction_spec.rb
@@ -686,8 +685,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
686
685
  - !ruby/object:Gem::Version
687
686
  version: '0'
688
687
  requirements: []
689
- rubyforge_project:
690
- rubygems_version: 2.6.13
688
+ rubygems_version: 3.0.3
691
689
  signing_key:
692
690
  specification_version: 4
693
691
  summary: QTI 1.2 and 2.1 import and export models
@@ -710,6 +708,7 @@ test_files:
710
708
  - spec/fixtures/items_1.2/canvas_multiple_dropdowns.xml
711
709
  - spec/fixtures/items_1.2/canvas_multiple_fib.xml
712
710
  - spec/fixtures/items_1.2/canvas_multiple_fib_as_single.xml
711
+ - spec/fixtures/items_1.2/canvas_multiple_fib_extra_brackets.xml
713
712
  - spec/fixtures/items_1.2/choice.xml
714
713
  - spec/fixtures/items_1.2/essay.xml
715
714
  - spec/fixtures/items_1.2/fib.xml
@@ -967,11 +966,8 @@ test_files:
967
966
  - spec/fixtures/with_banks/non_cc_assessments/gab22de457404cb5cf022078f1e4da75e.xml.qti
968
967
  - spec/fixtures/with_banks/non_cc_assessments/gf3edf8167be16b3a65a00ca923132b07.xml.qti
969
968
  - spec/gemfiles/rails-5.1.gemfile
970
- - spec/gemfiles/rails-5.1.gemfile.lock
971
969
  - spec/gemfiles/rails-5.2.gemfile
972
- - spec/gemfiles/rails-5.2.gemfile.lock
973
970
  - spec/gemfiles/rails-6.0.gemfile
974
- - spec/gemfiles/rails-6.0.gemfile.lock
975
971
  - spec/lib/qti/assessment_item_exporter_spec.rb
976
972
  - spec/lib/qti/exporter_spec.rb
977
973
  - spec/lib/qti/models/assessment_meta_spec.rb
@@ -983,6 +979,7 @@ test_files:
983
979
  - spec/lib/qti/v1/models/assessment_spec.rb
984
980
  - spec/lib/qti/v1/models/choices/fill_blank_choice_spec.rb
985
981
  - spec/lib/qti/v1/models/choices/logical_identifier_choice_spec.rb
982
+ - spec/lib/qti/v1/models/interactions/base_fill_blank_interaction_spec.rb
986
983
  - spec/lib/qti/v1/models/interactions/base_interaction_spec.rb
987
984
  - spec/lib/qti/v1/models/interactions/canvas_multiple_dropdown_spec.rb
988
985
  - spec/lib/qti/v1/models/interactions/choice_interaction_spec.rb
@@ -1,212 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- qti (2.1.0)
5
- actionview (>= 5.1.7, < 6.1)
6
- activesupport (>= 5.1.7, < 6.1)
7
- dry-struct (~> 0.4.0)
8
- dry-types (~> 0.12.3)
9
- mathml2latex (~> 2.0)
10
- nokogiri (~> 1.10)
11
- rubyzip (~> 2.0)
12
- sanitize (~> 5.1)
13
-
14
- GEM
15
- remote: https://rubygems.org/
16
- specs:
17
- actioncable (5.1.7)
18
- actionpack (= 5.1.7)
19
- nio4r (~> 2.0)
20
- websocket-driver (~> 0.6.1)
21
- actionmailer (5.1.7)
22
- actionpack (= 5.1.7)
23
- actionview (= 5.1.7)
24
- activejob (= 5.1.7)
25
- mail (~> 2.5, >= 2.5.4)
26
- rails-dom-testing (~> 2.0)
27
- actionpack (5.1.7)
28
- actionview (= 5.1.7)
29
- activesupport (= 5.1.7)
30
- rack (~> 2.0)
31
- rack-test (>= 0.6.3)
32
- rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
- actionview (5.1.7)
35
- activesupport (= 5.1.7)
36
- builder (~> 3.1)
37
- erubi (~> 1.4)
38
- rails-dom-testing (~> 2.0)
39
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
40
- activejob (5.1.7)
41
- activesupport (= 5.1.7)
42
- globalid (>= 0.3.6)
43
- activemodel (5.1.7)
44
- activesupport (= 5.1.7)
45
- activerecord (5.1.7)
46
- activemodel (= 5.1.7)
47
- activesupport (= 5.1.7)
48
- arel (~> 8.0)
49
- activesupport (5.1.7)
50
- concurrent-ruby (~> 1.0, >= 1.0.2)
51
- i18n (>= 0.7, < 2)
52
- minitest (~> 5.1)
53
- tzinfo (~> 1.1)
54
- arel (8.0.0)
55
- ast (2.4.0)
56
- builder (3.2.4)
57
- byebug (11.1.3)
58
- coderay (1.1.2)
59
- concurrent-ruby (1.1.6)
60
- crass (1.0.6)
61
- diff-lcs (1.3)
62
- docile (1.3.2)
63
- dry-configurable (0.11.5)
64
- concurrent-ruby (~> 1.0)
65
- dry-core (~> 0.4, >= 0.4.7)
66
- dry-equalizer (~> 0.2)
67
- dry-container (0.7.2)
68
- concurrent-ruby (~> 1.0)
69
- dry-configurable (~> 0.1, >= 0.1.3)
70
- dry-core (0.4.9)
71
- concurrent-ruby (~> 1.0)
72
- dry-equalizer (0.3.0)
73
- dry-logic (0.6.1)
74
- concurrent-ruby (~> 1.0)
75
- dry-core (~> 0.2)
76
- dry-equalizer (~> 0.2)
77
- dry-struct (0.4.0)
78
- dry-core (~> 0.4, >= 0.4.1)
79
- dry-equalizer (~> 0.2)
80
- dry-types (~> 0.12, >= 0.12.2)
81
- ice_nine (~> 0.11)
82
- dry-types (0.12.3)
83
- concurrent-ruby (~> 1.0)
84
- dry-configurable (~> 0.1)
85
- dry-container (~> 0.3)
86
- dry-core (~> 0.2, >= 0.2.1)
87
- dry-equalizer (~> 0.2)
88
- dry-logic (~> 0.4, >= 0.4.2)
89
- inflecto (~> 0.0.0, >= 0.0.2)
90
- erubi (1.9.0)
91
- globalid (0.4.2)
92
- activesupport (>= 4.2.0)
93
- i18n (1.8.2)
94
- concurrent-ruby (~> 1.0)
95
- ice_nine (0.11.2)
96
- inflecto (0.0.2)
97
- jaro_winkler (1.5.4)
98
- loofah (2.5.0)
99
- crass (~> 1.0.2)
100
- nokogiri (>= 1.5.9)
101
- mail (2.7.1)
102
- mini_mime (>= 0.1.1)
103
- mathml2latex (2.0.0)
104
- nokogiri (~> 1.10)
105
- method_source (1.0.0)
106
- mini_mime (1.0.2)
107
- mini_portile2 (2.4.0)
108
- minitest (5.14.0)
109
- nio4r (2.5.2)
110
- nokogiri (1.10.9)
111
- mini_portile2 (~> 2.4.0)
112
- nokogumbo (2.0.2)
113
- nokogiri (~> 1.8, >= 1.8.4)
114
- parallel (1.19.1)
115
- parser (2.7.1.2)
116
- ast (~> 2.4.0)
117
- pry (0.13.1)
118
- coderay (~> 1.1)
119
- method_source (~> 1.0)
120
- rack (2.2.2)
121
- rack-test (1.1.0)
122
- rack (>= 1.0, < 3)
123
- rails (5.1.7)
124
- actioncable (= 5.1.7)
125
- actionmailer (= 5.1.7)
126
- actionpack (= 5.1.7)
127
- actionview (= 5.1.7)
128
- activejob (= 5.1.7)
129
- activemodel (= 5.1.7)
130
- activerecord (= 5.1.7)
131
- activesupport (= 5.1.7)
132
- bundler (>= 1.3.0)
133
- railties (= 5.1.7)
134
- sprockets-rails (>= 2.0.0)
135
- rails-dom-testing (2.0.3)
136
- activesupport (>= 4.2.0)
137
- nokogiri (>= 1.6)
138
- rails-html-sanitizer (1.3.0)
139
- loofah (~> 2.3)
140
- railties (5.1.7)
141
- actionpack (= 5.1.7)
142
- activesupport (= 5.1.7)
143
- method_source
144
- rake (>= 0.8.7)
145
- thor (>= 0.18.1, < 2.0)
146
- rainbow (3.0.0)
147
- rake (12.3.3)
148
- rspec (3.9.0)
149
- rspec-core (~> 3.9.0)
150
- rspec-expectations (~> 3.9.0)
151
- rspec-mocks (~> 3.9.0)
152
- rspec-core (3.9.2)
153
- rspec-support (~> 3.9.3)
154
- rspec-expectations (3.9.2)
155
- diff-lcs (>= 1.2.0, < 2.0)
156
- rspec-support (~> 3.9.0)
157
- rspec-mocks (3.9.1)
158
- diff-lcs (>= 1.2.0, < 2.0)
159
- rspec-support (~> 3.9.0)
160
- rspec-support (3.9.3)
161
- rubocop (0.74.0)
162
- jaro_winkler (~> 1.5.1)
163
- parallel (~> 1.10)
164
- parser (>= 2.6)
165
- rainbow (>= 2.2.2, < 4.0)
166
- ruby-progressbar (~> 1.7)
167
- unicode-display_width (>= 1.4.0, < 1.7)
168
- ruby-progressbar (1.10.1)
169
- rubyzip (2.3.0)
170
- sanitize (5.1.0)
171
- crass (~> 1.0.2)
172
- nokogiri (>= 1.8.0)
173
- nokogumbo (~> 2.0)
174
- simplecov (0.18.5)
175
- docile (~> 1.1)
176
- simplecov-html (~> 0.11)
177
- simplecov-html (0.12.2)
178
- sprockets (3.7.2)
179
- concurrent-ruby (~> 1.0)
180
- rack (> 1, < 3)
181
- sprockets-rails (3.2.1)
182
- actionpack (>= 4.0)
183
- activesupport (>= 4.0)
184
- sprockets (>= 3.0.0)
185
- thor (1.0.1)
186
- thread_safe (0.3.6)
187
- tzinfo (1.2.7)
188
- thread_safe (~> 0.1)
189
- unicode-display_width (1.6.1)
190
- websocket-driver (0.6.5)
191
- websocket-extensions (>= 0.1.0)
192
- websocket-extensions (0.1.4)
193
- wwtd (1.4.1)
194
-
195
- PLATFORMS
196
- ruby
197
-
198
- DEPENDENCIES
199
- bundler (~> 1.17)
200
- byebug (~> 11.0)
201
- pry
202
- qti!
203
- rails (~> 5.1.4)
204
- rake (~> 12.3)
205
- rspec (~> 3.8)
206
- rspec-mocks (~> 3.8)
207
- rubocop (~> 0.74.0)
208
- simplecov
209
- wwtd (~> 1.4)
210
-
211
- BUNDLED WITH
212
- 1.17.3