qti 1.0.11 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/qti.rb +72 -19
  4. data/lib/qti/content_packaging.rb +0 -8
  5. data/lib/qti/models/assessment_meta.rb +0 -2
  6. data/lib/qti/models/base.rb +0 -5
  7. data/lib/qti/models/manifest.rb +1 -7
  8. data/lib/qti/models/metadata.rb +0 -7
  9. data/lib/qti/models/resource.rb +4 -10
  10. data/lib/qti/sanitizer.rb +0 -4
  11. data/lib/qti/v1/models/assessment.rb +1 -3
  12. data/lib/qti/v1/models/assessment_item.rb +0 -3
  13. data/lib/qti/v1/models/base.rb +0 -2
  14. data/lib/qti/v1/models/choices/fill_blank_choice.rb +0 -2
  15. data/lib/qti/v1/models/choices/logical_identifier_choice.rb +0 -2
  16. data/lib/qti/v1/models/interactions.rb +0 -4
  17. data/lib/qti/v1/models/interactions/base_fill_blank_interaction.rb +1 -1
  18. data/lib/qti/v1/models/interactions/formula_interaction.rb +2 -4
  19. data/lib/qti/v1/models/interactions/match_interaction.rb +2 -2
  20. data/lib/qti/v1/models/numerics/exact_match.rb +0 -2
  21. data/lib/qti/v1/models/numerics/margin_error.rb +0 -2
  22. data/lib/qti/v1/models/numerics/precision.rb +1 -3
  23. data/lib/qti/v1/models/numerics/within_range.rb +0 -2
  24. data/lib/qti/v1/models/question_group.rb +0 -3
  25. data/lib/qti/v2/models/assessment_item.rb +0 -3
  26. data/lib/qti/v2/models/assessment_test.rb +2 -5
  27. data/lib/qti/v2/models/base.rb +0 -2
  28. data/lib/qti/v2/models/choices/gap_match_choice.rb +0 -2
  29. data/lib/qti/v2/models/choices/simple_associable_choice.rb +0 -2
  30. data/lib/qti/v2/models/choices/simple_choice.rb +0 -2
  31. data/lib/qti/v2/models/interactions.rb +0 -3
  32. data/lib/qti/v2/models/interactions/ordering_interaction.rb +0 -2
  33. data/lib/qti/v2/models/non_assessment_test.rb +2 -4
  34. data/lib/qti/version.rb +1 -1
  35. data/spec/gemfiles/nokogiri-1.6.gemfile.lock +149 -0
  36. data/spec/gemfiles/nokogiri-1.8.gemfile.lock +149 -0
  37. data/spec/gemfiles/rails-5.2.gemfile.lock +222 -0
  38. data/spec/gemfiles/{rails-5.0.gemfile → rails-6.0.gemfile} +1 -1
  39. data/spec/lib/qti/assessment_item_exporter_spec.rb +17 -21
  40. data/spec/lib/qti/exporter_spec.rb +73 -81
  41. data/spec/lib/qti/models/assessment_meta_spec.rb +0 -2
  42. data/spec/lib/qti/models/base_spec.rb +20 -15
  43. data/spec/lib/qti/models/manifest_spec.rb +0 -2
  44. data/spec/lib/qti/models/metadata_spec.rb +0 -2
  45. data/spec/lib/qti/models/resource_spec.rb +0 -2
  46. data/spec/lib/qti/v1/models/assessment_item_spec.rb +9 -13
  47. data/spec/lib/qti/v1/models/assessment_spec.rb +3 -6
  48. data/spec/lib/qti/v1/models/choices/fill_blank_choice_spec.rb +0 -2
  49. data/spec/lib/qti/v1/models/choices/logical_identifier_choice_spec.rb +0 -2
  50. data/spec/lib/qti/v1/models/interactions/base_interaction_spec.rb +1 -3
  51. data/spec/lib/qti/v1/models/interactions/canvas_multiple_dropdown_spec.rb +0 -2
  52. data/spec/lib/qti/v1/models/interactions/choice_interaction_spec.rb +0 -2
  53. data/spec/lib/qti/v1/models/interactions/fill_blank_interaction_spec.rb +0 -2
  54. data/spec/lib/qti/v1/models/interactions/formula_interaction_spec.rb +0 -2
  55. data/spec/lib/qti/v1/models/interactions/match_interaction_spec.rb +0 -2
  56. data/spec/lib/qti/v1/models/interactions/numeric_interaction_spec.rb +0 -2
  57. data/spec/lib/qti/v1/models/interactions/ordering_interaction_spec.rb +0 -2
  58. data/spec/lib/qti/v1/models/interactions/string_interaction_spec.rb +0 -2
  59. data/spec/lib/qti/v1/models/interactions/upload_interaction_spec.rb +0 -2
  60. data/spec/lib/qti/v1/models/interactions_spec.rb +0 -2
  61. data/spec/lib/qti/v1/models/numerics/exact_match_spec.rb +0 -2
  62. data/spec/lib/qti/v1/models/numerics/margin_error_spec.rb +0 -2
  63. data/spec/lib/qti/v1/models/numerics/precision_spec.rb +0 -2
  64. data/spec/lib/qti/v1/models/numerics/scoring_base_spec.rb +0 -2
  65. data/spec/lib/qti/v1/models/numerics/scoring_node_spec.rb +0 -2
  66. data/spec/lib/qti/v1/models/numerics/within_range_spec.rb +0 -2
  67. data/spec/lib/qti/v1/models/question_group_spec.rb +0 -2
  68. data/spec/lib/qti/v1/models/stimulus_item_spec.rb +0 -2
  69. data/spec/lib/qti/v2/models/assessment_item_spec.rb +0 -2
  70. data/spec/lib/qti/v2/models/assessment_test_spec.rb +1 -4
  71. data/spec/lib/qti/v2/models/choices/gap_match_choice_spec.rb +0 -2
  72. data/spec/lib/qti/v2/models/choices/simple_associable_choice_spec.rb +0 -2
  73. data/spec/lib/qti/v2/models/choices/simple_choice_spec.rb +0 -2
  74. data/spec/lib/qti/v2/models/interactions/categorization_interaction_spec.rb +0 -2
  75. data/spec/lib/qti/v2/models/interactions/choice_interaction_spec.rb +0 -2
  76. data/spec/lib/qti/v2/models/interactions/extended_text_interaction_spec.rb +0 -2
  77. data/spec/lib/qti/v2/models/interactions/gap_match_interaction_spec.rb +0 -2
  78. data/spec/lib/qti/v2/models/interactions/match_interaction_spec.rb +0 -2
  79. data/spec/lib/qti/v2/models/interactions/ordering_interaction_spec.rb +0 -2
  80. data/spec/lib/qti/v2/models/interactions/short_text_interaction_spec.rb +0 -2
  81. data/spec/lib/qti/v2/models/non_assessment_test_spec.rb +0 -2
  82. data/spec/lib/qti/v2/models/object_element_spec.rb +0 -2
  83. data/spec/lib/qti/v2/models/stimulus_item_spec.rb +0 -2
  84. data/spec/lib/qti_spec.rb +0 -2
  85. data/spec/spec_helper.rb +5 -7
  86. data/spec/support/custom_matchers.rb +0 -2
  87. metadata +70 -70
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec path: '../../'
4
4
 
5
- gem 'rails', '~> 5.0.6'
5
+ gem 'rails', '~> 6.0.0'
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::AssessmentItemExporter do
4
2
  let(:assessment_item) do
5
3
  Qti::ContentPackaging::AssessmentItem.new(
@@ -24,25 +22,23 @@ describe Qti::AssessmentItemExporter do
24
22
  exporter = Qti::AssessmentItemExporter.new(assessment_item, package_root_path: dir)
25
23
  exporter.export
26
24
 
27
- expect(exporter.exported_file_path).to have_file_content(
28
- <<-XML.strip_heredoc
29
- <?xml version="1.0" encoding="UTF-8"?>
30
- <assessmentItem 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" timeDependent="false" identifier="Item-1" title="Question 1">
31
- <responseDeclaration identifier="RESPONSE" cardinality="single" baseType="identifier">
32
- <correctResponse>
33
- <value>true</value>
34
- </correctResponse>
35
- </responseDeclaration>
36
- <itemBody>
37
- <choiceInteraction responseIdentifier="RESPONSE" shuffle="false" maxChoices="1">
38
- <prompt>Is 1+1 equals 2?</prompt>
39
- <simpleChoice identifier="true" fixed="true">True</simpleChoice>
40
- <simpleChoice identifier="false" fixed="true">False</simpleChoice>
41
- </choiceInteraction>
42
- </itemBody>
43
- </assessmentItem>
44
- XML
45
- )
25
+ expect(exporter.exported_file_path).to have_file_content(<<~XML)
26
+ <?xml version="1.0" encoding="UTF-8"?>
27
+ <assessmentItem 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" timeDependent="false" identifier="Item-1" title="Question 1">
28
+ <responseDeclaration identifier="RESPONSE" cardinality="single" baseType="identifier">
29
+ <correctResponse>
30
+ <value>true</value>
31
+ </correctResponse>
32
+ </responseDeclaration>
33
+ <itemBody>
34
+ <choiceInteraction responseIdentifier="RESPONSE" shuffle="false" maxChoices="1">
35
+ <prompt>Is 1+1 equals 2?</prompt>
36
+ <simpleChoice identifier="true" fixed="true">True</simpleChoice>
37
+ <simpleChoice identifier="false" fixed="true">False</simpleChoice>
38
+ </choiceInteraction>
39
+ </itemBody>
40
+ </assessmentItem>
41
+ XML
46
42
  end
47
43
  end
48
44
  end
@@ -1,10 +1,8 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::Exporter do
4
2
  describe '#export' do
5
3
  let(:dir) { Dir.mktmpdir }
6
- let(:test_identifier) { SecureRandom.uuid }
7
- let(:item_identifier) { SecureRandom.uuid }
4
+ let(:test_identifier) { 'd87c42ec-9174-4685-8aba-cb95815b1cd4' }
5
+ let(:item_identifier) { 'ddf41010-79e4-4268-8aac-3a7e83c4cc97' }
8
6
  let(:assessment_test) do
9
7
  Qti::ContentPackaging::AssessmentTest.new(
10
8
  identifier: test_identifier,
@@ -52,91 +50,85 @@ describe Qti::Exporter do
52
50
  end
53
51
 
54
52
  it 'generates the xml for the empty assessment' do
55
- expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(
56
- <<-XML.strip_heredoc
57
- <?xml version="1.0" encoding="UTF-8"?>
58
- <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" title="Empty test">
59
- <testPart identifier="Main" navigationMode="linear" submissionMode="individual"/>
60
- </assessmentTest>
61
- XML
62
- )
53
+ expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(<<~XML)
54
+ <?xml version="1.0" encoding="UTF-8"?>
55
+ <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" title="Empty test">
56
+ <testPart identifier="Main" navigationMode="linear" submissionMode="individual"/>
57
+ </assessmentTest>
58
+ XML
63
59
  end
64
60
  end
65
61
 
66
62
  it 'generates the xml for an assessment with an item' do
67
63
  expect(exporter.exported_file_path).to contain_zip_entry("#{item_identifier}.xml")
68
- expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(
69
- <<-XML.strip_heredoc
70
- <?xml version="1.0" encoding="UTF-8"?>
71
- <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" title="Example test">
72
- <outcomeDeclaration baseType="float" cardinality="single" identifier="TEST_total">
73
- <defaultValue>
74
- <value>0</value>
75
- </defaultValue>
76
- </outcomeDeclaration>
77
- <outcomeDeclaration baseType="float" cardinality="single" identifier="S1">
78
- <defaultValue>
79
- <value>0</value>
80
- </defaultValue>
81
- </outcomeDeclaration>
82
- <testPart identifier="Main" navigationMode="linear" submissionMode="individual">
83
- <assessmentSection identifier="S1" visible="true" title="Section 1">
84
- <assessmentItemRef identifier="#{item_identifier}" href="#{item_identifier}.xml"/>
85
- </assessmentSection>
86
- </testPart>
87
- </assessmentTest>
88
- XML
89
- )
64
+ expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(<<~XML)
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" title="Example test">
67
+ <outcomeDeclaration baseType="float" cardinality="single" identifier="TEST_total">
68
+ <defaultValue>
69
+ <value>0</value>
70
+ </defaultValue>
71
+ </outcomeDeclaration>
72
+ <outcomeDeclaration baseType="float" cardinality="single" identifier="S1">
73
+ <defaultValue>
74
+ <value>0</value>
75
+ </defaultValue>
76
+ </outcomeDeclaration>
77
+ <testPart identifier="Main" navigationMode="linear" submissionMode="individual">
78
+ <assessmentSection identifier="S1" visible="true" title="Section 1">
79
+ <assessmentItemRef identifier="#{item_identifier}" href="#{item_identifier}.xml"/>
80
+ </assessmentSection>
81
+ </testPart>
82
+ </assessmentTest>
83
+ XML
90
84
  end
91
85
 
92
86
  it 'generates the xml for the manifest' do
93
- expect(exporter.exported_file_path).to have_zip_entry('imsmanifest.xml').with_content(
94
- <<-XML.strip_heredoc
95
- <?xml version="1.0" encoding="UTF-8"?>
96
- <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/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd http://ltsc.ieee.org/xsd/LOM http://www.imsglobal.org/xsd/imsmd_loose_v1p3p2.xsdhttp://www.imsglobal.org/xsd/imscp_v1p1 http://www.imsglobal.org/xsd/qti/qtiv2p2/qtiv2p2_imscpv1p2_v1p0.xsd" identifier="#{test_identifier}">
97
- <metadata>
98
- <schema>QTIv2.2 Package</schema>
99
- <schemaversion>1.0.0</schemaversion>
100
- <imsmd:lom>
101
- <imsmd:general>
102
- <imsmd:identifier>
103
- <imsmd:entry>FB-02</imsmd:entry>
104
- </imsmd:identifier>
105
- <imsmd:title>
106
- <imsmd:string language="en">Example test</imsmd:string>
107
- </imsmd:title>
108
- <imsmd:language>en</imsmd:language>
109
- <imsmd:description>
110
- <imsmd:string language="en">Instructure QTI package.Feedback XML used as an example of unprocessable entity</imsmd:string>
111
- </imsmd:description>
112
- <imsmd:keyword>
113
- <imsmd:string language="en">feedback</imsmd:string>
114
- </imsmd:keyword>
115
- <imsmd:keyword>
116
- <imsmd:string language="en">modal</imsmd:string>
117
- </imsmd:keyword>
118
- <imsmd:keyword>
119
- <imsmd:string language="en">test</imsmd:string>
120
- </imsmd:keyword>
121
- <imsmd:keyword>
122
- <imsmd:string language="en">inline</imsmd:string>
123
- </imsmd:keyword>
124
- <imsmd:keyword>
125
- <imsmd:string language="en">block</imsmd:string>
126
- </imsmd:keyword>
127
- </imsmd:general>
128
- </imsmd:lom>
129
- </metadata>
130
- <organizations/>
131
- <resources>
132
- <resource href="assessment.xml" type="imsqti_test_xmlv2p2" identifier="TEST">
133
- <file href="assessment.xml"/>
134
- <file href="#{item_identifier}.xml"/>
135
- </resource>
136
- </resources>
137
- </manifest>
138
- XML
139
- )
87
+ expect(exporter.exported_file_path).to have_zip_entry('imsmanifest.xml').with_content(<<~XML)
88
+ <?xml version="1.0" encoding="UTF-8"?>
89
+ <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/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd http://ltsc.ieee.org/xsd/LOM http://www.imsglobal.org/xsd/imsmd_loose_v1p3p2.xsdhttp://www.imsglobal.org/xsd/imscp_v1p1 http://www.imsglobal.org/xsd/qti/qtiv2p2/qtiv2p2_imscpv1p2_v1p0.xsd" identifier="#{test_identifier}">
90
+ <metadata>
91
+ <schema>QTIv2.2 Package</schema>
92
+ <schemaversion>1.0.0</schemaversion>
93
+ <imsmd:lom>
94
+ <imsmd:general>
95
+ <imsmd:identifier>
96
+ <imsmd:entry>FB-02</imsmd:entry>
97
+ </imsmd:identifier>
98
+ <imsmd:title>
99
+ <imsmd:string language="en">Example test</imsmd:string>
100
+ </imsmd:title>
101
+ <imsmd:language>en</imsmd:language>
102
+ <imsmd:description>
103
+ <imsmd:string language="en">Instructure QTI package.Feedback XML used as an example of unprocessable entity</imsmd:string>
104
+ </imsmd:description>
105
+ <imsmd:keyword>
106
+ <imsmd:string language="en">feedback</imsmd:string>
107
+ </imsmd:keyword>
108
+ <imsmd:keyword>
109
+ <imsmd:string language="en">modal</imsmd:string>
110
+ </imsmd:keyword>
111
+ <imsmd:keyword>
112
+ <imsmd:string language="en">test</imsmd:string>
113
+ </imsmd:keyword>
114
+ <imsmd:keyword>
115
+ <imsmd:string language="en">inline</imsmd:string>
116
+ </imsmd:keyword>
117
+ <imsmd:keyword>
118
+ <imsmd:string language="en">block</imsmd:string>
119
+ </imsmd:keyword>
120
+ </imsmd:general>
121
+ </imsmd:lom>
122
+ </metadata>
123
+ <organizations/>
124
+ <resources>
125
+ <resource href="assessment.xml" type="imsqti_test_xmlv2p2" identifier="TEST">
126
+ <file href="assessment.xml"/>
127
+ <file href="#{item_identifier}.xml"/>
128
+ </resource>
129
+ </resources>
130
+ </manifest>
131
+ XML
140
132
  end
141
133
  end
142
134
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  context 'Canvas Assessment Meta Data' do
4
2
  let(:fixtures_path) { File.join('spec', 'fixtures') }
5
3
  let(:file_path) { File.join(fixtures_path, qti_file) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::Models::Base do
4
2
  context 'specified as single content node matching helpers' do
5
3
  let(:loaded_class) do
@@ -63,48 +61,55 @@ describe Qti::Models::Base do
63
61
  let(:ftp) { 'ftp://foo.bar/' }
64
62
  let(:http) { 'http://foo.bar/' }
65
63
  let(:https) { 'https://foo.bar' }
64
+ let(:closing_tag) { true }
66
65
 
67
66
  shared_examples_for 'specific html elements' do
68
67
  it 'removes a src with a bad protocol' do
69
- ftp_tag = "<#{tag_name} #{src_attr}=\"#{ftp}\"></#{tag_name}>"
70
- expect(loaded_class.sanitize_content!(ftp_tag)).to eq "<#{tag_name}></#{tag_name}>"
68
+ ftp_tag = "<#{tag_name} #{src_attr}=\"#{ftp}\">"
69
+ ftp_tag += "</#{tag_name}>" if closing_tag
70
+ expected_tag = "<#{tag_name}>"
71
+ expected_tag += "</#{tag_name}>" if closing_tag
72
+ expect(loaded_class.sanitize_content!(ftp_tag)).to eq(expected_tag)
71
73
  end
72
74
 
73
75
  it 'removes a src with a valid http protocol' do
74
- http_tag = "<#{tag_name} #{src_attr}=\"#{http}\"></#{tag_name}>"
76
+ http_tag = "<#{tag_name} #{src_attr}=\"#{http}\">"
77
+ http_tag += "</#{tag_name}>" if closing_tag
75
78
  expect(loaded_class.sanitize_content!(http_tag)).to eq(http_tag)
76
79
  end
77
80
 
78
81
  it 'removes a src with a valid https protocol' do
79
- https_tag = "<#{tag_name} #{src_attr}=\"#{https}\"></#{tag_name}>"
82
+ https_tag = "<#{tag_name} #{src_attr}=\"#{https}\">"
83
+ https_tag += "</#{tag_name}>" if closing_tag
80
84
  expect(loaded_class.sanitize_content!(https_tag)).to eq(https_tag)
81
85
  end
82
86
  end
83
87
 
84
- describe 'iframe elements' do
85
- let(:tag_name) { 'iframe' }
88
+ describe 'embed elements' do
89
+ let(:tag_name) { 'embed' }
86
90
  let(:src_attr) { 'src' }
91
+ let(:closing_tag) { false }
87
92
 
88
93
  include_examples('specific html elements')
89
94
  end
90
95
 
91
- describe 'object elements' do
92
- let(:tag_name) { 'object' }
96
+ describe 'iframe elements' do
97
+ let(:tag_name) { 'iframe' }
93
98
  let(:src_attr) { 'src' }
94
99
 
95
100
  include_examples('specific html elements')
96
101
  end
97
102
 
98
- describe 'embed elements' do
99
- let(:tag_name) { 'embed' }
100
- let(:src_attr) { 'src' }
103
+ describe 'object elements with data' do
104
+ let(:tag_name) { 'object' }
105
+ let(:src_attr) { 'data' }
101
106
 
102
107
  include_examples('specific html elements')
103
108
  end
104
109
 
105
- describe 'object elements' do
110
+ describe 'object elements with src' do
106
111
  let(:tag_name) { 'object' }
107
- let(:src_attr) { 'data' }
112
+ let(:src_attr) { 'src' }
108
113
 
109
114
  include_examples('specific html elements')
110
115
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  fixtures_path = File.join('spec', 'fixtures')
4
2
 
5
3
  describe Qti::Models::Manifest do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  fixtures_path = File.join('spec', 'fixtures')
4
2
 
5
3
  describe Qti::Models::Manifest do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  fixtures_path = File.join('spec', 'fixtures')
4
2
 
5
3
  describe Qti::Models::Manifest do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::V1::Models::AssessmentItem do
4
2
  context 'multiple_fib' do
5
3
  let(:file_path) { File.join('spec', 'fixtures', 'items_1.2', 'single_fib.xml') }
@@ -39,18 +37,16 @@ describe Qti::V1::Models::AssessmentItem do
39
37
  end
40
38
 
41
39
  it 'returns 0 by default' do
42
- doc =
43
- <<-XML.strip_heredoc
44
- <?xml version="1.0" encoding="ISO-8859-1"?>
45
- <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">
46
- <outcomes>
47
- <decvar vartype="Decimal" varname="que_score"/>
48
- </outcomes>
49
- </questestinterop>
50
- XML
51
- node = Nokogiri.XML(doc, &:noblanks)
40
+ node = Nokogiri.XML(<<~XML, &:noblanks)
41
+ <?xml version="1.0" encoding="ISO-8859-1"?>
42
+ <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">
43
+ <outcomes>
44
+ <decvar vartype="Decimal" varname="que_score"/>
45
+ </outcomes>
46
+ </questestinterop>
47
+ XML
52
48
  assessment_item = described_class.new(node)
53
- expect(assessment_item.points_possible). to eq 1
49
+ expect(assessment_item.points_possible).to eq 1
54
50
  end
55
51
  end
56
52
 
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::V1::Models::Assessment do
4
2
  describe 'interaction item' do
5
3
  let(:fixtures_path) { File.join('spec', 'fixtures') }
@@ -53,12 +51,12 @@ describe Qti::V1::Models::Assessment do
53
51
  {
54
52
  interaction_class: Qti::V1::Models::Interactions::StringInteraction,
55
53
  title: 'Question',
56
- feedback: { neutral: '<p>General Feedback</p>' }
54
+ feedback: { neutral: '<p>General Feedback</p>' }
57
55
  },
58
56
  {
59
57
  interaction_class: Qti::V1::Models::Interactions::ChoiceInteraction,
60
58
  title: 'Question',
61
- feedback: { neutral: '<p>Neutral</p>', correct: '<p>Correct</p>', incorrect: '<p>Incorrect</p>' }
59
+ feedback: { neutral: '<p>Neutral</p>', correct: '<p>Correct</p>', incorrect: '<p>Incorrect</p>' }
62
60
  },
63
61
  {
64
62
  interaction_class: Qti::V1::Models::Interactions::ChoiceInteraction,
@@ -173,14 +171,13 @@ describe Qti::V1::Models::Assessment do
173
171
 
174
172
  context '<assessmentTest> has no title property' do
175
173
  it 'sets the title to the filename by default' do
176
- empty_test_string = <<~XML.strip_heredoc
174
+ allow(File).to receive(:read).and_return(<<~XML)
177
175
  <?xml version="1.0" encoding="UTF-8"?>
178
176
  <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">
179
177
  <assessment ident="A1001">
180
178
  </assessment>
181
179
  </questestinterop>
182
180
  XML
183
- allow(File).to receive(:read).and_return(empty_test_string)
184
181
  assessment_test = described_class.new path: '/a/b/c/Test123.xml'
185
182
  expect(assessment_test.title).to eq 'Test123'
186
183
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::V1::Models::Choices::FillBlankChoice do
4
2
  context 'fib.xml' do
5
3
  let(:fixtures_path) { File.join('spec', 'fixtures') }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::V1::Models::Choices::LogicalIdentifierChoice do
4
2
  context 'quiz.xml' do
5
3
  let(:fixtures_path) { File.join('spec', 'fixtures') }
@@ -1,8 +1,6 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::V1::Models::Interactions::BaseInteraction do
4
2
  let(:doc) do
5
- <<-XML.strip_heredoc
3
+ <<~XML
6
4
  <?xml version="1.0" encoding="ISO-8859-1"?>
7
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">
8
6
  <response_lid ident="QUE_1008_RL" rtiming="No">
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::V1::Models::Interactions::CanvasMultipleDropdownInteraction do
4
2
  let(:fixtures_path) { File.join('spec', 'fixtures', 'items_1.2') }
5
3
  let(:test_object) { Qti::V1::Models::Assessment.from_path!(file_path) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::V1::Models::Interactions::ChoiceInteraction do
4
2
  let(:fixtures_path) { File.join('spec', 'fixtures', 'items_1.2') }
5
3
  let(:test_object) { Qti::V1::Models::Assessment.from_path!(file_path) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Qti::V1::Models::Interactions::FillBlankInteraction do
4
2
  let(:fixtures_path) { File.join('spec', 'fixtures', 'items_1.2') }
5
3
  let(:test_object) { Qti::V1::Models::Assessment.from_path!(file_path) }