qti 2.5.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/qti/v1/models/assessment.rb +4 -0
- data/lib/qti/v1/models/object_bank.rb +4 -0
- data/lib/qti/v2/models/assessment_test.rb +4 -0
- data/lib/qti/version.rb +1 -1
- data/spec/lib/qti/v1/models/assessment_spec.rb +9 -0
- data/spec/lib/qti/v1/models/object_bank_spec.rb +25 -13
- data/spec/lib/qti/v2/models/assessment_test_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb32e14ee86e7c85cf22b461d411e17321ebe7a96c5727fd78df4f70adee12f0
|
4
|
+
data.tar.gz: 40d79b54aa1c73109512a9b40761ca2d9af1e71bfddca3881d4a8bd921dad381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14938cdfe0af943580f0d6af4429b0942a57e8f2b6c5083a65efa49832b6b01fd063444ab5a7a5b51416f12603698d799e62f00cc1aacfb120580e2ca31cf7fd
|
7
|
+
data.tar.gz: bce723b2da53fa956f2ae7b7f76d8ce6ae24fd253e991016ddfc049ff7c9618255e6e9979b0e0d233ff6176d1b2a4d65ae2744e36b108f59dab9e4be2db8892a
|
@@ -6,6 +6,10 @@ module Qti
|
|
6
6
|
|
7
7
|
GROUP_ID = 'xmlns:section/xmlns:selection_ordering'.freeze
|
8
8
|
|
9
|
+
def identifier
|
10
|
+
@identifier ||= xpath_with_single_check('.//xmlns:assessment/@ident')&.content
|
11
|
+
end
|
12
|
+
|
9
13
|
def title
|
10
14
|
@title ||= xpath_with_single_check('.//xmlns:assessment/@title')&.content || File.basename(@path, '.xml')
|
11
15
|
end
|
@@ -8,6 +8,10 @@ module Qti
|
|
8
8
|
'.//xmlns:qtimetadatafield/xmlns:fieldlabel[text()="bank_title"]/../xmlns:fieldentry'
|
9
9
|
)&.content || File.basename(@path, '.xml')
|
10
10
|
end
|
11
|
+
|
12
|
+
def identifier
|
13
|
+
@identifier ||= xpath_with_single_check('.//xmlns:objectbank/@ident')&.content
|
14
|
+
end
|
11
15
|
end
|
12
16
|
end
|
13
17
|
end
|
@@ -5,6 +5,10 @@ module Qti
|
|
5
5
|
include Qti::Models::AssessmentMetaBase
|
6
6
|
include Qti::XPathHelpers
|
7
7
|
|
8
|
+
def identifier
|
9
|
+
@identifier ||= xpath_with_single_check('//xmlns:assessmentTest/@identifier')&.content
|
10
|
+
end
|
11
|
+
|
8
12
|
def title
|
9
13
|
@title ||= xpath_with_single_check('//xmlns:assessmentTest/@title')&.content || File.basename(@path, '.xml')
|
10
14
|
end
|
data/lib/qti/version.rb
CHANGED
@@ -19,6 +19,12 @@ describe Qti::V1::Models::Assessment do
|
|
19
19
|
expect(loaded_class.assessment_items.count).to eq(expected_item_count)
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
describe '#identifier' do
|
24
|
+
it 'has the identifier' do
|
25
|
+
expect(loaded_class.identifier).to eq(expected_identifier)
|
26
|
+
end
|
27
|
+
end
|
22
28
|
end
|
23
29
|
|
24
30
|
shared_examples_for 'verify quiz items' do
|
@@ -36,6 +42,7 @@ describe Qti::V1::Models::Assessment do
|
|
36
42
|
let(:path) { File.join(fixtures_path, 'test_qti_1.2', 'quiz.xml') }
|
37
43
|
let(:loaded_class) { described_class.from_path!(path) }
|
38
44
|
let(:expected_title) { '1.2 Import Quiz' }
|
45
|
+
let(:expected_identifier) { 'A1001' }
|
39
46
|
let(:expected_item_count) { 5 }
|
40
47
|
|
41
48
|
include_examples('basic quiz fields')
|
@@ -45,6 +52,7 @@ describe Qti::V1::Models::Assessment do
|
|
45
52
|
let(:path) { File.join(fixtures_path, 'feedback_quiz_1.2.xml') }
|
46
53
|
let(:loaded_class) { described_class.from_path!(path) }
|
47
54
|
let(:expected_title) { 'I Can Haz Feedback' }
|
55
|
+
let(:expected_identifier) { 'i618e88580f76f70a1ed28804f497df9c' }
|
48
56
|
let(:expected_item_count) { 3 }
|
49
57
|
let(:expected_item_data) do
|
50
58
|
[
|
@@ -74,6 +82,7 @@ describe Qti::V1::Models::Assessment do
|
|
74
82
|
let(:path) { File.join(fixtures_path, 'all_canvas_simple_1.2.xml') }
|
75
83
|
let(:loaded_class) { described_class.from_path!(path) }
|
76
84
|
let(:expected_title) { 'Every Canvas Interaction' }
|
85
|
+
let(:expected_identifier) { 'ie09bc528e6ecd1cb9ebfafd940c20215' }
|
77
86
|
let(:expected_item_count) { 10 }
|
78
87
|
let(:expected_item_data) do
|
79
88
|
[
|
@@ -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(
|
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
|
+
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: 2021-
|
12
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionview
|