qti 0.6.0 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qti/exporter.rb +3 -0
- data/lib/qti/models/manifest.rb +3 -2
- data/lib/qti/v2/models/interactions/base_interaction.rb +0 -6
- data/spec/fixtures/test_qti_1.2_canvas/i00f37ac2af026e5a607e4a5d9a70b1d5/assessment_meta.xml +57 -0
- data/spec/fixtures/test_qti_1.2_canvas/i00f37ac2af026e5a607e4a5d9a70b1d5/i00f37ac2af026e5a607e4a5d9a70b1d5.xml +211 -0
- data/spec/fixtures/test_qti_1.2_canvas/imsmanifest.xml +39 -0
- data/spec/lib/qti/exporter_spec.rb +72 -25
- data/spec/lib/qti_spec.rb +12 -4
- metadata +9 -5
- data/spec/support/monkey_patches.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32735598f7ec291fe14aab5a31757d952a17e8e2
|
4
|
+
data.tar.gz: 223ef180406750c5a26e730c90b36c0bfe9dce2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a227d279db27d0096cb49bd4d9e714e100bbadedc9727b5def87a9a4f270aa4787e2f1c9313a61a0e39f7cbf6669467b8ad08a9a7b262f2433b130e2e836d11d
|
7
|
+
data.tar.gz: 7dd75b19053e9e751ec21c81560d3a371ba98b9f856c7821b50a985169a3eb6e30b32c409998906587cc9e0b9b32b565faf4a6f6e7f21f28426ec5fed077e6b2
|
data/lib/qti/exporter.rb
CHANGED
@@ -121,6 +121,9 @@ module Qti
|
|
121
121
|
xml.resources do
|
122
122
|
xml.resource('href' => 'assessment.xml', 'type' => 'imsqti_test_xmlv2p2', 'identifier' => 'TEST') do
|
123
123
|
xml.file('href' => 'assessment.xml')
|
124
|
+
assessment_test.items.each do |item|
|
125
|
+
xml.file('href' => "#{item.identifier}.xml")
|
126
|
+
end
|
124
127
|
end
|
125
128
|
end
|
126
129
|
end
|
data/lib/qti/models/manifest.rb
CHANGED
@@ -9,12 +9,13 @@ module Qti
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def qti_1_href
|
12
|
-
xpath_with_single_check("//xmlns:resources/xmlns:resource[@type='imsqti_xmlv1p2']/@href")&.content
|
12
|
+
xpath_with_single_check("//xmlns:resources/xmlns:resource[@type='imsqti_xmlv1p2']/@href")&.content ||
|
13
|
+
xpath_with_single_check("//xmlns:resources/xmlns:resource[@type='imsqti_xmlv1p2']/xmlns:file/@href")&.content
|
13
14
|
end
|
14
15
|
|
15
16
|
def qti_2_x_href
|
16
17
|
xpath_with_single_check("//xmlns:resources/xmlns:resource[@type='imsqti_test_xmlv2p1']/@href")&.content ||
|
17
|
-
|
18
|
+
xpath_with_single_check("//xmlns:resources/xmlns:resource[@type='imsqti_test_xmlv2p2']/@href")&.content
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<quiz xmlns="http://canvas.instructure.com/xsd/cccv1p0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" identifier="i00f37ac2af026e5a607e4a5d9a70b1d5" xsi:schemaLocation="http://canvas.instructure.com/xsd/cccv1p0 http://canvas.instructure.com/xsd/cccv1p0.xsd">
|
3
|
+
<title>WIJsfijdi</title>
|
4
|
+
<description><p>sdvsv</p></description>
|
5
|
+
<shuffle_answers>false</shuffle_answers>
|
6
|
+
<scoring_policy>keep_highest</scoring_policy>
|
7
|
+
<quiz_type>assignment</quiz_type>
|
8
|
+
<points_possible>4.0</points_possible>
|
9
|
+
<require_lockdown_browser>false</require_lockdown_browser>
|
10
|
+
<require_lockdown_browser_for_results>false</require_lockdown_browser_for_results>
|
11
|
+
<require_lockdown_browser_monitor>false</require_lockdown_browser_monitor>
|
12
|
+
<lockdown_browser_monitor_data/>
|
13
|
+
<show_correct_answers>true</show_correct_answers>
|
14
|
+
<anonymous_submissions>false</anonymous_submissions>
|
15
|
+
<could_be_locked>false</could_be_locked>
|
16
|
+
<allowed_attempts>1</allowed_attempts>
|
17
|
+
<one_question_at_a_time>false</one_question_at_a_time>
|
18
|
+
<cant_go_back>false</cant_go_back>
|
19
|
+
<available>true</available>
|
20
|
+
<one_time_results>false</one_time_results>
|
21
|
+
<show_correct_answers_last_attempt>false</show_correct_answers_last_attempt>
|
22
|
+
<only_visible_to_overrides>false</only_visible_to_overrides>
|
23
|
+
<module_locked>false</module_locked>
|
24
|
+
<assignment identifier="if391c6d69f65c14c668b771864713cfe">
|
25
|
+
<title>WIJsfijdi</title>
|
26
|
+
<due_at/>
|
27
|
+
<lock_at/>
|
28
|
+
<unlock_at/>
|
29
|
+
<module_locked>false</module_locked>
|
30
|
+
<workflow_state>published</workflow_state>
|
31
|
+
<assignment_overrides>
|
32
|
+
</assignment_overrides>
|
33
|
+
<quiz_identifierref>i00f37ac2af026e5a607e4a5d9a70b1d5</quiz_identifierref>
|
34
|
+
<has_group_category>false</has_group_category>
|
35
|
+
<points_possible>4.0</points_possible>
|
36
|
+
<grading_type>points</grading_type>
|
37
|
+
<all_day>false</all_day>
|
38
|
+
<submission_types>online_quiz</submission_types>
|
39
|
+
<position>6</position>
|
40
|
+
<turnitin_enabled>false</turnitin_enabled>
|
41
|
+
<vericite_enabled>false</vericite_enabled>
|
42
|
+
<peer_review_count>0</peer_review_count>
|
43
|
+
<peer_reviews>false</peer_reviews>
|
44
|
+
<automatic_peer_reviews>false</automatic_peer_reviews>
|
45
|
+
<moderated_grading>false</moderated_grading>
|
46
|
+
<anonymous_peer_reviews>false</anonymous_peer_reviews>
|
47
|
+
<grade_group_students_individually>false</grade_group_students_individually>
|
48
|
+
<freeze_on_copy>false</freeze_on_copy>
|
49
|
+
<muted>false</muted>
|
50
|
+
<omit_from_final_grade>false</omit_from_final_grade>
|
51
|
+
<intra_group_peer_reviews>false</intra_group_peer_reviews>
|
52
|
+
<only_visible_to_overrides>false</only_visible_to_overrides>
|
53
|
+
</assignment>
|
54
|
+
<assignment_group_identifierref>i2fba2c8de8c85704fba9b320f17dd84f</assignment_group_identifierref>
|
55
|
+
<assignment_overrides>
|
56
|
+
</assignment_overrides>
|
57
|
+
</quiz>
|
@@ -0,0 +1,211 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<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">
|
3
|
+
<assessment ident="i00f37ac2af026e5a607e4a5d9a70b1d5" title="WIJsfijdi">
|
4
|
+
<qtimetadata>
|
5
|
+
<qtimetadatafield>
|
6
|
+
<fieldlabel>cc_maxattempts</fieldlabel>
|
7
|
+
<fieldentry>1</fieldentry>
|
8
|
+
</qtimetadatafield>
|
9
|
+
</qtimetadata>
|
10
|
+
<section ident="root_section">
|
11
|
+
<item ident="i684d5931341c096d99a050f07a8d2b15" title="Question 1">
|
12
|
+
<itemmetadata>
|
13
|
+
<qtimetadata>
|
14
|
+
<qtimetadatafield>
|
15
|
+
<fieldlabel>question_type</fieldlabel>
|
16
|
+
<fieldentry>true_false_question</fieldentry>
|
17
|
+
</qtimetadatafield>
|
18
|
+
<qtimetadatafield>
|
19
|
+
<fieldlabel>points_possible</fieldlabel>
|
20
|
+
<fieldentry>1.0</fieldentry>
|
21
|
+
</qtimetadatafield>
|
22
|
+
<qtimetadatafield>
|
23
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
24
|
+
<fieldentry>i0408152cfe87bafd6293d61a2c6bbb59</fieldentry>
|
25
|
+
</qtimetadatafield>
|
26
|
+
</qtimetadata>
|
27
|
+
</itemmetadata>
|
28
|
+
<presentation>
|
29
|
+
<material>
|
30
|
+
<mattext texttype="text/html"><div><p>afsdf</p></div></mattext>
|
31
|
+
</material>
|
32
|
+
<response_lid ident="response1" rcardinality="Single">
|
33
|
+
<render_choice>
|
34
|
+
<response_label ident="6467">
|
35
|
+
<material>
|
36
|
+
<mattext texttype="text/plain">True</mattext>
|
37
|
+
</material>
|
38
|
+
</response_label>
|
39
|
+
<response_label ident="4608">
|
40
|
+
<material>
|
41
|
+
<mattext texttype="text/plain">False</mattext>
|
42
|
+
</material>
|
43
|
+
</response_label>
|
44
|
+
</render_choice>
|
45
|
+
</response_lid>
|
46
|
+
</presentation>
|
47
|
+
<resprocessing>
|
48
|
+
<outcomes>
|
49
|
+
<decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
|
50
|
+
</outcomes>
|
51
|
+
<respcondition continue="No">
|
52
|
+
<conditionvar>
|
53
|
+
<varequal respident="response1">6467</varequal>
|
54
|
+
</conditionvar>
|
55
|
+
<setvar action="Set" varname="SCORE">100</setvar>
|
56
|
+
</respcondition>
|
57
|
+
</resprocessing>
|
58
|
+
</item>
|
59
|
+
<item ident="i3a908ae57f0e84620c9c98a7ccc207ba" title="Question">
|
60
|
+
<itemmetadata>
|
61
|
+
<qtimetadata>
|
62
|
+
<qtimetadatafield>
|
63
|
+
<fieldlabel>question_type</fieldlabel>
|
64
|
+
<fieldentry>multiple_choice_question</fieldentry>
|
65
|
+
</qtimetadatafield>
|
66
|
+
<qtimetadatafield>
|
67
|
+
<fieldlabel>points_possible</fieldlabel>
|
68
|
+
<fieldentry>1.0</fieldentry>
|
69
|
+
</qtimetadatafield>
|
70
|
+
<qtimetadatafield>
|
71
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
72
|
+
<fieldentry>i3f7fa71f7152bb71cfc017c52a83424f</fieldentry>
|
73
|
+
</qtimetadatafield>
|
74
|
+
</qtimetadata>
|
75
|
+
</itemmetadata>
|
76
|
+
<presentation>
|
77
|
+
<material>
|
78
|
+
<mattext texttype="text/html"><div><p>sdfsdfs</p></div></mattext>
|
79
|
+
</material>
|
80
|
+
<response_lid ident="response1" rcardinality="Single">
|
81
|
+
<render_choice>
|
82
|
+
<response_label ident="2031">
|
83
|
+
<material>
|
84
|
+
<mattext texttype="text/plain">True</mattext>
|
85
|
+
</material>
|
86
|
+
</response_label>
|
87
|
+
<response_label ident="1064">
|
88
|
+
<material>
|
89
|
+
<mattext texttype="text/plain">Sss</mattext>
|
90
|
+
</material>
|
91
|
+
</response_label>
|
92
|
+
<response_label ident="4656">
|
93
|
+
<material>
|
94
|
+
<mattext texttype="text/plain">False</mattext>
|
95
|
+
</material>
|
96
|
+
</response_label>
|
97
|
+
</render_choice>
|
98
|
+
</response_lid>
|
99
|
+
</presentation>
|
100
|
+
<resprocessing>
|
101
|
+
<outcomes>
|
102
|
+
<decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
|
103
|
+
</outcomes>
|
104
|
+
<respcondition continue="No">
|
105
|
+
<conditionvar>
|
106
|
+
<varequal respident="response1">2031</varequal>
|
107
|
+
</conditionvar>
|
108
|
+
<setvar action="Set" varname="SCORE">100</setvar>
|
109
|
+
</respcondition>
|
110
|
+
</resprocessing>
|
111
|
+
</item>
|
112
|
+
<item ident="ib9660eb1a61a14e7cba8be7060fbb869" title="Question">
|
113
|
+
<itemmetadata>
|
114
|
+
<qtimetadata>
|
115
|
+
<qtimetadatafield>
|
116
|
+
<fieldlabel>question_type</fieldlabel>
|
117
|
+
<fieldentry>multiple_answers_question</fieldentry>
|
118
|
+
</qtimetadatafield>
|
119
|
+
<qtimetadatafield>
|
120
|
+
<fieldlabel>points_possible</fieldlabel>
|
121
|
+
<fieldentry>1.0</fieldentry>
|
122
|
+
</qtimetadatafield>
|
123
|
+
<qtimetadatafield>
|
124
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
125
|
+
<fieldentry>ia940853811e6fec4813688a1f9a48f3f</fieldentry>
|
126
|
+
</qtimetadatafield>
|
127
|
+
</qtimetadata>
|
128
|
+
</itemmetadata>
|
129
|
+
<presentation>
|
130
|
+
<material>
|
131
|
+
<mattext texttype="text/html"><div><p>sdfsdfgs</p></div></mattext>
|
132
|
+
</material>
|
133
|
+
<response_lid ident="response1" rcardinality="Multiple">
|
134
|
+
<render_choice>
|
135
|
+
<response_label ident="5119">
|
136
|
+
<material>
|
137
|
+
<mattext texttype="text/plain">ssdsd</mattext>
|
138
|
+
</material>
|
139
|
+
</response_label>
|
140
|
+
<response_label ident="6216">
|
141
|
+
<material>
|
142
|
+
<mattext texttype="text/plain">asdsad</mattext>
|
143
|
+
</material>
|
144
|
+
</response_label>
|
145
|
+
<response_label ident="1766">
|
146
|
+
<material>
|
147
|
+
<mattext texttype="text/plain">ddsd</mattext>
|
148
|
+
</material>
|
149
|
+
</response_label>
|
150
|
+
</render_choice>
|
151
|
+
</response_lid>
|
152
|
+
</presentation>
|
153
|
+
<resprocessing>
|
154
|
+
<outcomes>
|
155
|
+
<decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
|
156
|
+
</outcomes>
|
157
|
+
<respcondition continue="No">
|
158
|
+
<conditionvar>
|
159
|
+
<and>
|
160
|
+
<varequal respident="response1">5119</varequal>
|
161
|
+
<varequal respident="response1">6216</varequal>
|
162
|
+
<not>
|
163
|
+
<varequal respident="response1">1766</varequal>
|
164
|
+
</not>
|
165
|
+
</and>
|
166
|
+
</conditionvar>
|
167
|
+
<setvar action="Set" varname="SCORE">100</setvar>
|
168
|
+
</respcondition>
|
169
|
+
</resprocessing>
|
170
|
+
</item>
|
171
|
+
<item ident="i713c2da8e263ef6492797b23ba8bb691" title="Question">
|
172
|
+
<itemmetadata>
|
173
|
+
<qtimetadata>
|
174
|
+
<qtimetadatafield>
|
175
|
+
<fieldlabel>question_type</fieldlabel>
|
176
|
+
<fieldentry>essay_question</fieldentry>
|
177
|
+
</qtimetadatafield>
|
178
|
+
<qtimetadatafield>
|
179
|
+
<fieldlabel>points_possible</fieldlabel>
|
180
|
+
<fieldentry>1.0</fieldentry>
|
181
|
+
</qtimetadatafield>
|
182
|
+
<qtimetadatafield>
|
183
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
184
|
+
<fieldentry>i8781f75406455a8bb030dac714aae76f</fieldentry>
|
185
|
+
</qtimetadatafield>
|
186
|
+
</qtimetadata>
|
187
|
+
</itemmetadata>
|
188
|
+
<presentation>
|
189
|
+
<material>
|
190
|
+
<mattext texttype="text/html"><div><p>dsfsdfsdf</p></div></mattext>
|
191
|
+
</material>
|
192
|
+
<response_str ident="response1" rcardinality="Single">
|
193
|
+
<render_fib>
|
194
|
+
<response_label ident="answer1" rshuffle="No"/>
|
195
|
+
</render_fib>
|
196
|
+
</response_str>
|
197
|
+
</presentation>
|
198
|
+
<resprocessing>
|
199
|
+
<outcomes>
|
200
|
+
<decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
|
201
|
+
</outcomes>
|
202
|
+
<respcondition continue="No">
|
203
|
+
<conditionvar>
|
204
|
+
<other/>
|
205
|
+
</conditionvar>
|
206
|
+
</respcondition>
|
207
|
+
</resprocessing>
|
208
|
+
</item>
|
209
|
+
</section>
|
210
|
+
</assessment>
|
211
|
+
</questestinterop>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<manifest identifier="i56fa994ec2857901a029f2943f33a328" xmlns="http://www.imsglobal.org/xsd/imsccv1p1/imscp_v1p1" xmlns:lom="http://ltsc.ieee.org/xsd/imsccv1p1/LOM/resource" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsccv1p1/imscp_v1p1 http://www.imsglobal.org/xsd/imscp_v1p1.xsd http://ltsc.ieee.org/xsd/imsccv1p1/LOM/resource http://www.imsglobal.org/profile/cc/ccv1p1/LOM/ccv1p1_lomresource_v1p0.xsd http://www.imsglobal.org/xsd/imsmd_v1p2 http://www.imsglobal.org/xsd/imsmd_v1p2p2.xsd">
|
3
|
+
<metadata>
|
4
|
+
<schema>IMS Content</schema>
|
5
|
+
<schemaversion>1.1.3</schemaversion>
|
6
|
+
<imsmd:lom>
|
7
|
+
<imsmd:general>
|
8
|
+
<imsmd:title>
|
9
|
+
<imsmd:string>QTI Quiz Export for course "6-19 course"</imsmd:string>
|
10
|
+
</imsmd:title>
|
11
|
+
</imsmd:general>
|
12
|
+
<imsmd:lifeCycle>
|
13
|
+
<imsmd:contribute>
|
14
|
+
<imsmd:date>
|
15
|
+
<imsmd:dateTime>2017-06-19</imsmd:dateTime>
|
16
|
+
</imsmd:date>
|
17
|
+
</imsmd:contribute>
|
18
|
+
</imsmd:lifeCycle>
|
19
|
+
<imsmd:rights>
|
20
|
+
<imsmd:copyrightAndOtherRestrictions>
|
21
|
+
<imsmd:value>yes</imsmd:value>
|
22
|
+
</imsmd:copyrightAndOtherRestrictions>
|
23
|
+
<imsmd:description>
|
24
|
+
<imsmd:string>Private (Copyrighted) - http://en.wikipedia.org/wiki/Copyright</imsmd:string>
|
25
|
+
</imsmd:description>
|
26
|
+
</imsmd:rights>
|
27
|
+
</imsmd:lom>
|
28
|
+
</metadata>
|
29
|
+
<organizations/>
|
30
|
+
<resources>
|
31
|
+
<resource identifier="i00f37ac2af026e5a607e4a5d9a70b1d5" type="imsqti_xmlv1p2">
|
32
|
+
<file href="i00f37ac2af026e5a607e4a5d9a70b1d5/i00f37ac2af026e5a607e4a5d9a70b1d5.xml"/>
|
33
|
+
<dependency identifierref="i469e25379db912b2fc11d031d250a5d1"/>
|
34
|
+
</resource>
|
35
|
+
<resource identifier="i469e25379db912b2fc11d031d250a5d1" type="associatedcontent/imscc_xmlv1p1/learning-application-resource" href="i00f37ac2af026e5a607e4a5d9a70b1d5/assessment_meta.xml">
|
36
|
+
<file href="i00f37ac2af026e5a607e4a5d9a70b1d5/assessment_meta.xml"/>
|
37
|
+
</resource>
|
38
|
+
</resources>
|
39
|
+
</manifest>
|
@@ -1,14 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Qti::Exporter do
|
4
|
-
let(:empty_assessment_test) do
|
5
|
-
Qti::ContentPackaging::AssessmentTest.new(
|
6
|
-
title: 'Empty test',
|
7
|
-
items: [],
|
8
|
-
outcome_declarations: []
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
4
|
let(:assessment_test) do
|
13
5
|
Qti::ContentPackaging::AssessmentTest.new(
|
14
6
|
title: 'Example test',
|
@@ -40,29 +32,35 @@ describe Qti::Exporter do
|
|
40
32
|
end
|
41
33
|
|
42
34
|
describe '#export' do
|
43
|
-
|
44
|
-
|
35
|
+
let(:dir) { Dir.mktmpdir }
|
36
|
+
let(:exporter) { Qti::Exporter.new(assessment_test, package_root_path: dir) }
|
45
37
|
|
46
|
-
|
38
|
+
before do
|
47
39
|
exporter.export
|
48
|
-
|
49
|
-
expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(
|
50
|
-
<<-XML.strip_heredoc
|
51
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
52
|
-
<assessmentTest xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2" 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" title="Empty test">
|
53
|
-
<testPart/>
|
54
|
-
</assessmentTest>
|
55
|
-
XML
|
56
|
-
)
|
57
40
|
end
|
58
41
|
|
59
|
-
|
60
|
-
|
42
|
+
context 'empty assessment' do
|
43
|
+
let(:assessment_test) do
|
44
|
+
Qti::ContentPackaging::AssessmentTest.new(
|
45
|
+
title: 'Empty test',
|
46
|
+
items: [],
|
47
|
+
outcome_declarations: []
|
48
|
+
)
|
49
|
+
end
|
61
50
|
|
62
|
-
|
63
|
-
|
51
|
+
it 'generates the xml for the empty assessment' do
|
52
|
+
expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(
|
53
|
+
<<-XML.strip_heredoc
|
54
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
55
|
+
<assessmentTest xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2" 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" title="Empty test">
|
56
|
+
<testPart/>
|
57
|
+
</assessmentTest>
|
58
|
+
XML
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
64
62
|
|
65
|
-
|
63
|
+
it 'generates the xml for an assessment with an item' do
|
66
64
|
expect(exporter.exported_file_path).to contain_zip_entry('0b8664be39cf69ef76402f3e41eb05.xml')
|
67
65
|
expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(
|
68
66
|
<<-XML.strip_heredoc
|
@@ -87,5 +85,54 @@ describe Qti::Exporter do
|
|
87
85
|
XML
|
88
86
|
)
|
89
87
|
end
|
88
|
+
|
89
|
+
it 'generates the xml for the manifest' do
|
90
|
+
expect(exporter.exported_file_path).to have_zip_entry('imsmanifest.xml').with_content(
|
91
|
+
<<-XML.strip_heredoc
|
92
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
93
|
+
<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://ltsc.ieee.org/xsd/LOM" xmlns:imsqti="http://www.imsglobal.org/xsd/imsqti_v2p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 http://www.imsglobal.org/xsd/qti/qtiv2p2/qtiv2p2_imscpv1p2_v1p0.xsdhttp://ltsc.ieee.org/xsd/LOM http://www.imsglobal.org/xsd/imsmd_loose_v1p3p2.xsdhttp://www.imsglobal.org/xsd/imsqti_metadata_v2p2http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_metadata_v2p2.xsd">
|
94
|
+
<metadata>
|
95
|
+
<schema>QTIv2.2 Package</schema>
|
96
|
+
<schemaversion>1.0.0</schemaversion>
|
97
|
+
<imsmd:lom>
|
98
|
+
<general>
|
99
|
+
<identifier>
|
100
|
+
<entry>FB-02</entry>
|
101
|
+
</identifier>
|
102
|
+
<title>
|
103
|
+
<string language="en">Example test</string>
|
104
|
+
</title>
|
105
|
+
<language>en</language>
|
106
|
+
<description>
|
107
|
+
<string language="en">Instructure QTI package.Feedback XML used as an example of unprocessable entity</string>
|
108
|
+
</description>
|
109
|
+
</general>
|
110
|
+
<imsmd:keyword>
|
111
|
+
<imsmd:string language="en">feedback</imsmd:string>
|
112
|
+
</imsmd:keyword>
|
113
|
+
<imsmd:keyword>
|
114
|
+
<imsmd:string language="en">modal</imsmd:string>
|
115
|
+
</imsmd:keyword>
|
116
|
+
<imsmd:keyword>
|
117
|
+
<imsmd:string language="en">test</imsmd:string>
|
118
|
+
</imsmd:keyword>
|
119
|
+
<imsmd:keyword>
|
120
|
+
<imsmd:string language="en">inline</imsmd:string>
|
121
|
+
</imsmd:keyword>
|
122
|
+
<imsmd:keyword>
|
123
|
+
<imsmd:string language="en">block</imsmd:string>
|
124
|
+
</imsmd:keyword>
|
125
|
+
</imsmd:lom>
|
126
|
+
</metadata>
|
127
|
+
<resources>
|
128
|
+
<resource href="assessment.xml" type="imsqti_test_xmlv2p2" identifier="TEST">
|
129
|
+
<file href="assessment.xml"/>
|
130
|
+
<file href="0b8664be39cf69ef76402f3e41eb05.xml"/>
|
131
|
+
</resource>
|
132
|
+
</resources>
|
133
|
+
</manifest>
|
134
|
+
XML
|
135
|
+
)
|
136
|
+
end
|
90
137
|
end
|
91
138
|
end
|
data/spec/lib/qti_spec.rb
CHANGED
@@ -12,7 +12,6 @@ describe Qti::Importer do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
shared_examples_for 'unsupported QTI version' do
|
15
|
-
|
16
15
|
it 'raises an error' do
|
17
16
|
allow_any_instance_of(Qti::Models::Manifest).to receive(:assessment_test_href).and_return(nil)
|
18
17
|
expect { importer.import_manifest }.to raise_error('Unsupported QTI version')
|
@@ -28,13 +27,22 @@ describe Qti::Importer do
|
|
28
27
|
|
29
28
|
describe '#create_assessment_item' do
|
30
29
|
it 'create items with correct scoring structs' do
|
31
|
-
|
32
|
-
assessment_items = importer.assessment_item_refs.map{ |ref| importer.create_assessment_item(ref) }
|
30
|
+
importer.test_object
|
31
|
+
assessment_items = importer.assessment_item_refs.map { |ref| importer.create_assessment_item(ref) }
|
33
32
|
expect(assessment_items.count).to eq 5
|
34
|
-
answer_arity = assessment_items.map{|item| item.scoring_data_structs.count }
|
33
|
+
answer_arity = assessment_items.map { |item| item.scoring_data_structs.count }
|
35
34
|
expect(answer_arity).to eq [1, 1, 4, 1, 1]
|
36
35
|
end
|
37
36
|
end
|
37
|
+
|
38
|
+
context 'canvas generated' do
|
39
|
+
let(:file_path) { File.join(fixtures_path, 'test_qti_1.2_canvas') }
|
40
|
+
|
41
|
+
it 'imports a canvas generated quiz' do
|
42
|
+
importer.test_object
|
43
|
+
expect(importer.assessment_item_refs.count).to eq 4
|
44
|
+
end
|
45
|
+
end
|
38
46
|
end
|
39
47
|
|
40
48
|
context 'QTI 2.1' do
|
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.6.
|
4
|
+
version: 0.6.3
|
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: 2017-06-
|
12
|
+
date: 2017-06-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -354,6 +354,9 @@ files:
|
|
354
354
|
- spec/fixtures/test_qti_1.2/image.png
|
355
355
|
- spec/fixtures/test_qti_1.2/imsmanifest.xml
|
356
356
|
- spec/fixtures/test_qti_1.2/quiz.xml
|
357
|
+
- spec/fixtures/test_qti_1.2_canvas/i00f37ac2af026e5a607e4a5d9a70b1d5/assessment_meta.xml
|
358
|
+
- spec/fixtures/test_qti_1.2_canvas/i00f37ac2af026e5a607e4a5d9a70b1d5/i00f37ac2af026e5a607e4a5d9a70b1d5.xml
|
359
|
+
- spec/fixtures/test_qti_1.2_canvas/imsmanifest.xml
|
357
360
|
- spec/fixtures/test_qti_2.1.zip
|
358
361
|
- spec/fixtures/test_qti_2.1/Items/Item_VE_IP_01/qtiv2p1_EntryTest_VE_IP_01.xml
|
359
362
|
- spec/fixtures/test_qti_2.1/Items/Item_VE_IP_02/apip_VE_IP_02.css
|
@@ -459,7 +462,6 @@ files:
|
|
459
462
|
- spec/lib/qti_spec.rb
|
460
463
|
- spec/spec_helper.rb
|
461
464
|
- spec/support/custom_matchers.rb
|
462
|
-
- spec/support/monkey_patches.rb
|
463
465
|
homepage:
|
464
466
|
licenses: []
|
465
467
|
metadata: {}
|
@@ -479,7 +481,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
479
481
|
version: '0'
|
480
482
|
requirements: []
|
481
483
|
rubyforge_project:
|
482
|
-
rubygems_version: 2.
|
484
|
+
rubygems_version: 2.6.12
|
483
485
|
signing_key:
|
484
486
|
specification_version: 4
|
485
487
|
summary: QTI 1.2 and 2.1 import and export models
|
@@ -592,6 +594,9 @@ test_files:
|
|
592
594
|
- spec/fixtures/test_qti_1.2/image.png
|
593
595
|
- spec/fixtures/test_qti_1.2/imsmanifest.xml
|
594
596
|
- spec/fixtures/test_qti_1.2/quiz.xml
|
597
|
+
- spec/fixtures/test_qti_1.2_canvas/i00f37ac2af026e5a607e4a5d9a70b1d5/assessment_meta.xml
|
598
|
+
- spec/fixtures/test_qti_1.2_canvas/i00f37ac2af026e5a607e4a5d9a70b1d5/i00f37ac2af026e5a607e4a5d9a70b1d5.xml
|
599
|
+
- spec/fixtures/test_qti_1.2_canvas/imsmanifest.xml
|
595
600
|
- spec/fixtures/test_qti_2.1.zip
|
596
601
|
- spec/fixtures/test_qti_2.1/Items/Item_VE_IP_01/qtiv2p1_EntryTest_VE_IP_01.xml
|
597
602
|
- spec/fixtures/test_qti_2.1/Items/Item_VE_IP_02/apip_VE_IP_02.css
|
@@ -697,4 +702,3 @@ test_files:
|
|
697
702
|
- spec/lib/qti_spec.rb
|
698
703
|
- spec/spec_helper.rb
|
699
704
|
- spec/support/custom_matchers.rb
|
700
|
-
- spec/support/monkey_patches.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# ObjectSpace.each_object(Class).select { |c| c.name =~ /V1.*(?<!Base)Interaction$/ }.each do |klass|
|
2
|
-
# klass.class_eval do
|
3
|
-
# class << self
|
4
|
-
# alias_method :old_matches?, :matches?
|
5
|
-
# def matches?(node)
|
6
|
-
# raise ArgumentError.new("Expected Nokogiri::XML::Element and got #{node.class}") unless item_element?(node)
|
7
|
-
# old_matches?(node)
|
8
|
-
# end
|
9
|
-
# def item_element?(node)
|
10
|
-
# node.class == Nokogiri::XML::Element && node.name == 'item'
|
11
|
-
# end
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|