qti 0.7.6 → 0.7.7
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 +1 -1
- data/lib/qti/v2/models/assessment_test.rb +1 -1
- data/lib/qti/v2/models/interactions/short_text_interaction.rb +18 -0
- data/spec/fixtures/items_2.1/text_entry.xml +2 -6
- data/spec/lib/qti/v1/models/assessment_spec.rb +22 -2
- data/spec/lib/qti/v2/models/assessment_test_spec.rb +15 -0
- data/spec/lib/qti/v2/models/interactions/short_text_interaction_spec.rb +23 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37dccfba39c7ff45b6b624f53e83781b4f930dd7
|
4
|
+
data.tar.gz: 32b1734d6c6860d26d782b43b8aad9768fb09b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b2581f1059182c8455d41a4e822a7ebaa1311e474e7b0e6c15b5dd17e44efb7630e01dd56a84d9cee722a33fbe0096362860f96635af413ebd206e7d2a50c97
|
7
|
+
data.tar.gz: 4a67575c0709af214c3a6228fdbb0ec6cff7cb74d137d79b1b71b6af536995210b983d97b57b8c20988468cf9d835c249ec00ba2134399530a8e47600fd80cac
|
@@ -5,7 +5,7 @@ module Qti
|
|
5
5
|
module Models
|
6
6
|
class Assessment < Qti::V1::Models::Base
|
7
7
|
def title
|
8
|
-
@title ||= xpath_with_single_check('.//xmlns:assessment/@title')&.content
|
8
|
+
@title ||= xpath_with_single_check('.//xmlns:assessment/@title')&.content || File.basename(@path, '.xml')
|
9
9
|
end
|
10
10
|
|
11
11
|
def assessment_items
|
@@ -5,7 +5,7 @@ module Qti
|
|
5
5
|
module Models
|
6
6
|
class AssessmentTest < Qti::V2::Models::Base
|
7
7
|
def title
|
8
|
-
@title ||= xpath_with_single_check('//xmlns:assessmentTest/@title').
|
8
|
+
@title ||= xpath_with_single_check('//xmlns:assessmentTest/@title')&.content || File.basename(@path, ".xml")
|
9
9
|
end
|
10
10
|
|
11
11
|
def assessment_item_reference_hrefs
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Qti
|
2
|
+
module V2
|
3
|
+
module Models
|
4
|
+
module Interactions
|
5
|
+
class ShortTextInteraction < BaseInteraction
|
6
|
+
# This will know if a class matches
|
7
|
+
def self.matches(node)
|
8
|
+
matches = node.xpath('.//xmlns:textEntryInteraction')
|
9
|
+
return false if matches.empty?
|
10
|
+
|
11
|
+
raise Qti::UnsupportedSchema if matches.size > 1
|
12
|
+
new(matches.first)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,8 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2"
|
3
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
|
-
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd"
|
5
|
-
identifier="textEntry" title="Richard III (Take 3)" adaptive="false" timeDependent="false">
|
2
|
+
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd" identifier="textEntry" title="Richard III (Take 3)" adaptive="false" timeDependent="false">
|
6
3
|
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="string">
|
7
4
|
<correctResponse>
|
8
5
|
<value>York</value>
|
@@ -22,6 +19,5 @@
|
|
22
19
|
buried.</p>
|
23
20
|
</blockquote>
|
24
21
|
</itemBody>
|
25
|
-
<responseProcessing
|
26
|
-
template="http://www.imsglobal.org/question/qti_v2p2/rptemplates/map_response"/>
|
22
|
+
<responseProcessing template="http://www.imsglobal.org/question/qti_v2p2/rptemplates/map_response"/>
|
27
23
|
</assessmentItem>
|
@@ -12,7 +12,27 @@ describe Qti::V1::Models::Assessment do
|
|
12
12
|
end.to_not raise_error
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
describe '#title' do
|
16
|
+
context '<assessmentTest> has a title property' do
|
17
|
+
it 'has the title' do
|
18
|
+
expect(loaded_class.title).to eq '1.2 Import Quiz'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context '<assessmentTest> has no title property' do
|
23
|
+
it 'sets the title to the filename by default' do
|
24
|
+
empty_test_string =
|
25
|
+
<<-XML.strip_heredoc
|
26
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
27
|
+
<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">
|
28
|
+
<assessment ident="A1001">
|
29
|
+
</assessment>
|
30
|
+
</questestinterop>
|
31
|
+
XML
|
32
|
+
allow(File).to receive(:read).and_return(empty_test_string)
|
33
|
+
assessment_test = described_class.new path: '/a/b/c/Test123.xml'
|
34
|
+
expect(assessment_test.title).to eq 'Test123'
|
35
|
+
end
|
36
|
+
end
|
17
37
|
end
|
18
38
|
end
|
@@ -57,4 +57,19 @@ describe Qti::V2::Models::AssessmentTest do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
|
+
|
61
|
+
describe '#title' do
|
62
|
+
it 'sets the title to the filename by default' do
|
63
|
+
empty_test_string =
|
64
|
+
<<-XML.strip_heredoc
|
65
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
66
|
+
<assessmentTest xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2p1" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd">
|
67
|
+
<testPart identifier="Main" navigationMode="linear" submissionMode="individual"/>
|
68
|
+
</assessmentTest>
|
69
|
+
XML
|
70
|
+
allow(File).to receive(:read).and_return(empty_test_string)
|
71
|
+
assessment_test = described_class.new path: '/a/b/c/Test123.xml'
|
72
|
+
expect(assessment_test.title).to eq 'Test123'
|
73
|
+
end
|
74
|
+
end
|
60
75
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Qti::V2::Models::Interactions::ShortTextInteraction do
|
4
|
+
context 'text_entry.xml' do
|
5
|
+
let(:assessment_item) { Qti::V2::Models::AssessmentItem.from_path! 'spec/fixtures/items_2.1/text_entry.xml' }
|
6
|
+
subject { assessment_item.interaction_model }
|
7
|
+
|
8
|
+
it { is_expected.to be_an_instance_of(described_class) }
|
9
|
+
|
10
|
+
it 'returns shuffle setting' do
|
11
|
+
expect(subject.shuffled?).to eq false
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'matches' do
|
15
|
+
it 'raises an exception when the item contains more than 1 <textEntryInteraction>' do
|
16
|
+
node = double('Nokogiri::XML::Document')
|
17
|
+
matches = [double('Nokogiri::XML::Element'), double('Nokogiri::XML::Element')]
|
18
|
+
allow(node).to receive(:xpath).with('.//xmlns:textEntryInteraction').and_return(matches)
|
19
|
+
expect{described_class.matches(node)}.to raise_error(Qti::UnsupportedSchema)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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.7.
|
4
|
+
version: 0.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannah Bottalla
|
@@ -245,6 +245,7 @@ files:
|
|
245
245
|
- lib/qti/v2/models/interactions/match_item_tag_processors/associate_interaction_tag_processor.rb
|
246
246
|
- lib/qti/v2/models/interactions/match_item_tag_processors/match_interaction_tag_processor.rb
|
247
247
|
- lib/qti/v2/models/interactions/ordering_interaction.rb
|
248
|
+
- lib/qti/v2/models/interactions/short_text_interaction.rb
|
248
249
|
- lib/qti/v2/models/scoring_data.rb
|
249
250
|
- spec/fixtures/items_1.2/choice.xml
|
250
251
|
- spec/fixtures/items_1.2/essay.xml
|
@@ -461,6 +462,7 @@ files:
|
|
461
462
|
- spec/lib/qti/v2/models/interactions/gap_match_interaction_spec.rb
|
462
463
|
- spec/lib/qti/v2/models/interactions/match_interaction_spec.rb
|
463
464
|
- spec/lib/qti/v2/models/interactions/ordering_interaction_spec.rb
|
465
|
+
- spec/lib/qti/v2/models/interactions/short_text_interaction_spec.rb
|
464
466
|
- spec/lib/qti_spec.rb
|
465
467
|
- spec/spec_helper.rb
|
466
468
|
- spec/support/custom_matchers.rb
|
@@ -703,6 +705,7 @@ test_files:
|
|
703
705
|
- spec/lib/qti/v2/models/interactions/gap_match_interaction_spec.rb
|
704
706
|
- spec/lib/qti/v2/models/interactions/match_interaction_spec.rb
|
705
707
|
- spec/lib/qti/v2/models/interactions/ordering_interaction_spec.rb
|
708
|
+
- spec/lib/qti/v2/models/interactions/short_text_interaction_spec.rb
|
706
709
|
- spec/lib/qti_spec.rb
|
707
710
|
- spec/spec_helper.rb
|
708
711
|
- spec/support/custom_matchers.rb
|