qti 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c740d1b3ac0a16f4661dd5ec3fe25691e3aacc4
4
- data.tar.gz: d487bd97b470c0948c4512e52cab356777c28674
3
+ metadata.gz: afd52bad22c9796edfbb8fd2fe412c955b0099a7
4
+ data.tar.gz: 73018306444c63ced0e4f45cc4b7d6a21a40ec99
5
5
  SHA512:
6
- metadata.gz: af2cbeb0a5efc6aefd940b238b57a6bc5c273b0601096323ea6beece7137b6c1fcacaa28c6a98840704d656d22bd3214d2661874bc6ad796a4b68b4813caeb2a
7
- data.tar.gz: 4b3b108554561f85eda5915f773b301ea396f6ec7e39ea2c46963498ab479f717b5f9f4198682c0bf86c73730f7f665cf330950fca3a69277c776fafb0bf25bd
6
+ metadata.gz: c96942dbe69be8e0bcedc61fd42d606d9d7d0cb14612d7d50e80dc17b52e1a363db023e0ba818e2c9bd533862cc25c9fa9ef68af5f5c1cd2c8e7af472fbd09c5
7
+ data.tar.gz: e6d932d96f046715d18fac372b095c01a416f300bb1383bef7b6f609ad51bb7bc52e86d9fda7d968b14ced89ccc7ab2631003dd8337c13f37597376b53417c86
@@ -1,23 +1,26 @@
1
1
  module Qti
2
2
  class AssessmentItemExporter
3
- attr_reader :index, :assessment_item, :package_root_path
3
+ attr_reader :assessment_item, :package_root_path, :exported_file_path
4
4
 
5
- def initialize(index, assessment_item, args = {})
6
- @index = index
5
+ def initialize(assessment_item, args = {})
7
6
  @assessment_item = assessment_item
8
7
  @package_root_path = args[:package_root_path] || '.'
9
8
  end
10
9
 
10
+ def exported_file_path
11
+ @exported_file_path ||= File.join(package_root_path, "#{assessment_item.identifier}.xml")
12
+ end
13
+
11
14
  def export
12
- File.open(File.join(package_root_path, "item-#{index + 1}.xml"), 'wb') do |f|
13
- f.write xml_string_for_assessment_item(assessment_item)
15
+ File.open(exported_file_path, 'wb') do |f|
16
+ f.write xml_string_for_assessment_item
14
17
  end
15
18
  end
16
19
 
17
20
  private
18
21
 
19
- def xml_string_for_assessment_item(assessment_item)
20
- builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
22
+ def xml_string_for_assessment_item
23
+ Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
21
24
  xml.assessmentItem(assesment_item_attributes) do
22
25
  xml.responseDeclaration('identifier' => 'RESPONSE',
23
26
  'cardinality' => cardinality_for_response(assessment_item),
@@ -28,8 +31,7 @@ module Qti
28
31
  end
29
32
  xml_assessment_item_body(xml, assessment_item)
30
33
  end
31
- end
32
- builder.to_xml
34
+ end.to_xml
33
35
  end
34
36
 
35
37
  def cardinality_for_response(assessment_item)
@@ -60,8 +62,8 @@ module Qti
60
62
  def assesment_item_attributes
61
63
  { 'xmlns' => 'http://www.imsglobal.org/xsd/imsqti_v2p2', 'xmlns:xi' => 'http://www.w3.org/2001/XInclude',
62
64
  'xmlns:m' => 'http://www.w3.org/1998/Math/MathML', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
63
- 'xsi:schemaLocation' => 'http://www.imsglobal.org/xsd/imsqti_v2p2
64
- http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd' }
65
+ 'xsi:schemaLocation' => 'http://www.imsglobal.org/xsd/imsqti_v2p2 ' \
66
+ 'http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd' }
65
67
  end
66
68
  end
67
69
  end
data/lib/qti/exporter.rb CHANGED
@@ -29,18 +29,20 @@ module Qti
29
29
  end
30
30
 
31
31
  def create_assessment_xml
32
- builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
32
+ File.open(File.join(package_root_path, 'assessment.xml'), 'wb') do |f|
33
+ f.write assessment_xml_string
34
+ end
35
+ end
36
+
37
+ def assessment_xml_string
38
+ Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
33
39
  xml.assessmentTest(assesment_test_attributes(title: assessment_test.title)) do
34
40
  outcome_declarations(xml, assessment_test)
35
41
  xml.testPart do
36
42
  xml_assessment_section(xml)
37
43
  end
38
44
  end
39
- end
40
-
41
- File.open(File.join(package_root_path, 'assessment.xml'), 'wb') do |f|
42
- f.write builder.to_xml
43
- end
45
+ end.to_xml
44
46
  end
45
47
 
46
48
  def outcome_declarations(xml, assessment_test)
@@ -56,9 +58,11 @@ module Qti
56
58
  end
57
59
 
58
60
  def xml_assessment_section(xml)
59
- xml.assessmentSection('identifier' => 'S1', 'visible' => 'true', 'title' => 'Section 1') do
60
- assessment_test.items.each_with_index do |item, index|
61
- xml.assessmentItemRef('identifier' => item.identifier, 'href' => "item-#{index + 1}.xml")
61
+ unless assessment_test.items.empty?
62
+ xml.assessmentSection('identifier' => 'S1', 'visible' => 'true', 'title' => 'Section 1') do
63
+ assessment_test.items.each do |item|
64
+ xml.assessmentItemRef('identifier' => item.identifier, 'href' => "#{item.identifier}.xml")
65
+ end
62
66
  end
63
67
  end
64
68
  end
@@ -123,15 +127,15 @@ module Qti
123
127
  end
124
128
 
125
129
  def export_items
126
- assessment_test.items.each_with_index do |assessment_item, index|
127
- Qti::AssessmentItemExporter.new(index, assessment_item, package_root_path: package_root_path).export
130
+ assessment_test.items.each do |assessment_item|
131
+ Qti::AssessmentItemExporter.new(assessment_item, package_root_path: package_root_path).export
128
132
  end
129
133
  end
130
134
 
131
135
  def assesment_test_attributes(args = {})
132
136
  { 'xmlns' => 'http://www.imsglobal.org/xsd/imsqti_v2p2', 'xmlns:xi' => 'http://www.w3.org/2001/XInclude',
133
137
  'xmlns:m' => 'http://www.w3.org/1998/Math/MathML', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
134
- 'xsi:schemaLocation' => 'http://www.imsglobal.org/xsd/imsqti_v2p2' \
138
+ 'xsi:schemaLocation' => 'http://www.imsglobal.org/xsd/imsqti_v2p2 ' \
135
139
  'http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd' }.merge(args)
136
140
  end
137
141
 
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe Qti::AssessmentItemExporter do
4
+ let(:assessment_item) do
5
+ Qti::ContentPackaging::AssessmentItem.new(
6
+ identifier: '1', title: 'Question 1', response: 'true',
7
+ interaction: Qti::ContentPackaging::ChoiceInteraction.new(
8
+ prompt: 'Is 1+1 equals 2?', maxChoices: 1,
9
+ choices: [
10
+ Qti::ContentPackaging::SimpleChoice.new(
11
+ identifier: 'true', body: 'True'
12
+ ),
13
+ Qti::ContentPackaging::SimpleChoice.new(
14
+ identifier: 'false', body: 'False'
15
+ )
16
+ ]
17
+ )
18
+ )
19
+ end
20
+
21
+ describe '#export' do
22
+ it 'generates the xml for an item' do
23
+ dir = Dir.mktmpdir
24
+ exporter = Qti::AssessmentItemExporter.new(1, assessment_item, package_root_path: dir)
25
+ exporter.export
26
+
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">
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
+ )
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+
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
+ let(:assessment_test) do
13
+ Qti::ContentPackaging::AssessmentTest.new(
14
+ title: 'Example test',
15
+ items: [
16
+ Qti::ContentPackaging::AssessmentItem.new(
17
+ identifier: '0b8664be39cf69ef76402f3e41eb05', title: 'Question 1', response: 'true',
18
+ interaction: Qti::ContentPackaging::ChoiceInteraction.new(
19
+ prompt: 'Is 1+1 equals 2?', maxChoices: 1,
20
+ choices: [
21
+ Qti::ContentPackaging::SimpleChoice.new(
22
+ identifier: 'true', body: 'True'
23
+ ),
24
+ Qti::ContentPackaging::SimpleChoice.new(
25
+ identifier: 'false', body: 'False'
26
+ )
27
+ ]
28
+ )
29
+ )
30
+ ],
31
+ outcome_declarations: [
32
+ Qti::ContentPackaging::OutcomeDeclaration.new(
33
+ identifier: 'TEST_total', baseType: 'float', cardinality: 'single', defaultValue: 0.0
34
+ ),
35
+ Qti::ContentPackaging::OutcomeDeclaration.new(
36
+ identifier: 'S1', baseType: 'float', cardinality: 'single', defaultValue: 0.0
37
+ )
38
+ ]
39
+ )
40
+ end
41
+
42
+ describe '#export' do
43
+ it 'generates the xml for the empty assessment' do
44
+ dir = Dir.mktmpdir
45
+
46
+ exporter = Qti::Exporter.new(empty_assessment_test, package_root_path: dir)
47
+ 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
+ end
58
+
59
+ it 'generates the xml for an assessment with an item' do
60
+ dir = Dir.mktmpdir
61
+
62
+ exporter = Qti::Exporter.new(assessment_test, package_root_path: dir)
63
+ exporter.export
64
+
65
+ expect(exporter.exported_file_path).to contain_zip_entry('imsmanifest.xml')
66
+ expect(exporter.exported_file_path).to contain_zip_entry('0b8664be39cf69ef76402f3e41eb05.xml')
67
+ expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(
68
+ <<-XML.strip_heredoc
69
+ <?xml version="1.0" encoding="UTF-8"?>
70
+ <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="Example test">
71
+ <outcomeDeclaration baseType="float" cardinality="single" identifier="TEST_total">
72
+ <defaultValue>
73
+ <value>0</value>
74
+ </defaultValue>
75
+ </outcomeDeclaration>
76
+ <outcomeDeclaration baseType="float" cardinality="single" identifier="S1">
77
+ <defaultValue>
78
+ <value>0</value>
79
+ </defaultValue>
80
+ </outcomeDeclaration>
81
+ <testPart>
82
+ <assessmentSection identifier="S1" visible="true" title="Section 1">
83
+ <assessmentItemRef identifier="0b8664be39cf69ef76402f3e41eb05" href="0b8664be39cf69ef76402f3e41eb05.xml"/>
84
+ </assessmentSection>
85
+ </testPart>
86
+ </assessmentTest>
87
+ XML
88
+ )
89
+ end
90
+ end
91
+ end
File without changes
File without changes
File without changes
File without changes
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  require 'bundler/setup'
2
2
  require 'byebug'
3
-
4
3
  Bundler.setup
5
4
 
6
5
  require 'qti'
7
6
 
7
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
8
+
8
9
  RSpec.configure do |config|
9
10
  config.expect_with :rspec do |expectations|
10
11
  expectations.syntax = :expect
@@ -0,0 +1,42 @@
1
+ require 'rspec/expectations'
2
+
3
+ RSpec::Matchers.define :have_file_content do |expected|
4
+ match do |actual|
5
+ File.read(actual) == expected
6
+ end
7
+ end
8
+
9
+ RSpec::Matchers.define :contain_zip_entry do |entry|
10
+ match do |file_path|
11
+ zip_entry = Zip::File.open(file_path) do |zip_file|
12
+ zip_file.glob(entry).first
13
+ end
14
+ expect(zip_entry).to be_present
15
+ end
16
+ end
17
+
18
+ RSpec::Matchers.define :have_zip_entry do |entry|
19
+ match do |file_path|
20
+ expect(file_content_in_zip_file(file_path, entry)).to eq(@expected_content)
21
+ end
22
+
23
+ failure_message do |file_path|
24
+ c = file_content_in_zip_file(file_path, entry)
25
+ if c.empty?
26
+ "expect #{file_path} to contain an entry #{entry}"
27
+ elsif c != @expected_content
28
+ RSpec::Support::Differ.new.diff(c, @expected_content)
29
+ end
30
+ end
31
+
32
+ def file_content_in_zip_file(file_path, entry)
33
+ Zip::File.open(file_path) do |zip_file|
34
+ e = zip_file.glob(entry).first
35
+ e.get_input_stream.read
36
+ end
37
+ end
38
+
39
+ chain :with_content do |expected_content|
40
+ @expected_content = expected_content
41
+ end
42
+ 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.2.2
4
+ version: 0.2.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-03-06 00:00:00.000000000 Z
12
+ date: 2017-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -186,10 +186,8 @@ files:
186
186
  - lib/qti/content_packaging/outcome_declaration.rb
187
187
  - lib/qti/content_packaging/simple_choice.rb
188
188
  - lib/qti/exporter.rb
189
- - lib/qti/item_exporter_factory.rb
190
189
  - lib/qti/models/base.rb
191
190
  - lib/qti/models/manifest.rb
192
- - lib/qti/true_false_item_exporter.rb
193
191
  - lib/qti/v1/models/assessment.rb
194
192
  - lib/qti/v1/models/assessment_item.rb
195
193
  - lib/qti/v1/models/base.rb
@@ -366,20 +364,22 @@ files:
366
364
  - spec/fixtures/tests/tests/rtest25.xml
367
365
  - spec/fixtures/tests/tests/rtest26.xml
368
366
  - spec/fixtures/tests/tests/rtest27.xml
369
- - spec/qti/exporter_spec.rb
370
- - spec/qti/models/base_spec.rb
371
- - spec/qti/models/manifest_spec.rb
372
- - spec/qti/v1/models/assessment_item_spec.rb
373
- - spec/qti/v1/models/assessment_spec.rb
374
- - spec/qti/v1/models/choices/logical_identifier_choice_spec.rb
375
- - spec/qti/v1/models/interactions/logical_identifier_interaction_spec.rb
376
- - spec/qti/v2/models/assessment_item_spec.rb
377
- - spec/qti/v2/models/assessment_test_spec.rb
378
- - spec/qti/v2/models/choices/simple_choice_spec.rb
379
- - spec/qti/v2/models/interactions/choice_interaction_spec.rb
380
- - spec/qti/v2/models/interactions/extended_text_interaction_spec.rb
381
- - spec/qti_spec.rb
367
+ - spec/lib/qti/assessment_item_exporter_spec.rb
368
+ - spec/lib/qti/exporter_spec.rb
369
+ - spec/lib/qti/models/base_spec.rb
370
+ - spec/lib/qti/models/manifest_spec.rb
371
+ - spec/lib/qti/v1/models/assessment_item_spec.rb
372
+ - spec/lib/qti/v1/models/assessment_spec.rb
373
+ - spec/lib/qti/v1/models/choices/logical_identifier_choice_spec.rb
374
+ - spec/lib/qti/v1/models/interactions/logical_identifier_interaction_spec.rb
375
+ - spec/lib/qti/v2/models/assessment_item_spec.rb
376
+ - spec/lib/qti/v2/models/assessment_test_spec.rb
377
+ - spec/lib/qti/v2/models/choices/simple_choice_spec.rb
378
+ - spec/lib/qti/v2/models/interactions/choice_interaction_spec.rb
379
+ - spec/lib/qti/v2/models/interactions/extended_text_interaction_spec.rb
380
+ - spec/lib/qti_spec.rb
382
381
  - spec/spec_helper.rb
382
+ - spec/support/custom_matchers.rb
383
383
  homepage:
384
384
  licenses: []
385
385
  metadata: {}
@@ -566,17 +566,19 @@ test_files:
566
566
  - spec/fixtures/tests/tests/rtest25.xml
567
567
  - spec/fixtures/tests/tests/rtest26.xml
568
568
  - spec/fixtures/tests/tests/rtest27.xml
569
- - spec/qti/exporter_spec.rb
570
- - spec/qti/models/base_spec.rb
571
- - spec/qti/models/manifest_spec.rb
572
- - spec/qti/v1/models/assessment_item_spec.rb
573
- - spec/qti/v1/models/assessment_spec.rb
574
- - spec/qti/v1/models/choices/logical_identifier_choice_spec.rb
575
- - spec/qti/v1/models/interactions/logical_identifier_interaction_spec.rb
576
- - spec/qti/v2/models/assessment_item_spec.rb
577
- - spec/qti/v2/models/assessment_test_spec.rb
578
- - spec/qti/v2/models/choices/simple_choice_spec.rb
579
- - spec/qti/v2/models/interactions/choice_interaction_spec.rb
580
- - spec/qti/v2/models/interactions/extended_text_interaction_spec.rb
581
- - spec/qti_spec.rb
569
+ - spec/lib/qti/assessment_item_exporter_spec.rb
570
+ - spec/lib/qti/exporter_spec.rb
571
+ - spec/lib/qti/models/base_spec.rb
572
+ - spec/lib/qti/models/manifest_spec.rb
573
+ - spec/lib/qti/v1/models/assessment_item_spec.rb
574
+ - spec/lib/qti/v1/models/assessment_spec.rb
575
+ - spec/lib/qti/v1/models/choices/logical_identifier_choice_spec.rb
576
+ - spec/lib/qti/v1/models/interactions/logical_identifier_interaction_spec.rb
577
+ - spec/lib/qti/v2/models/assessment_item_spec.rb
578
+ - spec/lib/qti/v2/models/assessment_test_spec.rb
579
+ - spec/lib/qti/v2/models/choices/simple_choice_spec.rb
580
+ - spec/lib/qti/v2/models/interactions/choice_interaction_spec.rb
581
+ - spec/lib/qti/v2/models/interactions/extended_text_interaction_spec.rb
582
+ - spec/lib/qti_spec.rb
582
583
  - spec/spec_helper.rb
584
+ - spec/support/custom_matchers.rb
@@ -1,15 +0,0 @@
1
- module Qti
2
- class ItemExporterFactory
3
- EXPORTER_CLASS = { 'TrueFalse' => TrueFalseItemExporter }.freeze
4
-
5
- def self.create(item, args = {})
6
- exporter_class = EXPORTER_CLASS[item.interaction_type] || NullExporter
7
- exporter_class.new(item, args)
8
- end
9
- end
10
-
11
- class NullExporter < ItemExporter
12
- def export
13
- end
14
- end
15
- end
@@ -1,7 +0,0 @@
1
- module Qti
2
- class TrueFalseItemExporter < ItemExporter
3
- def export
4
- xml_string_for_item(item)
5
- end
6
- end
7
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Qti::Exporter do
4
- let(:assessment_test) do
5
- Qti::ContentPackaging::AssessmentTest.new(
6
- title: 'Example test',
7
- items: [
8
- Qti::ContentPackaging::AssessmentItem.new(
9
- identifier: '1', title: 'Question 1', response: 'true',
10
- interaction: Qti::ContentPackaging::ChoiceInteraction.new(
11
- prompt: 'Is 1+1 equals 2?', maxChoices: 1,
12
- choices: [
13
- Qti::ContentPackaging::SimpleChoice.new(
14
- identifier: 'true', body: 'True'
15
- ),
16
- Qti::ContentPackaging::SimpleChoice.new(
17
- identifier: 'false', body: 'False'
18
- )
19
- ]
20
- )
21
- )
22
- ],
23
- outcome_declarations: [
24
- Qti::ContentPackaging::OutcomeDeclaration.new(
25
- identifier: 'TEST_total', baseType: 'float', cardinality: 'single', defaultValue: 0.0
26
- ),
27
- Qti::ContentPackaging::OutcomeDeclaration.new(
28
- identifier: 'S1', baseType: 'float', cardinality: 'single', defaultValue: 0.0
29
- )
30
- ]
31
- )
32
- end
33
-
34
- it 'creates the zip file' do
35
- dir = Dir.mktmpdir
36
-
37
- exporter = Qti::Exporter.new(assessment_test, package_root_path: dir)
38
- exporter.export
39
-
40
- expect(File.exist?(exporter.exported_file_path)).to be_truthy
41
- end
42
-
43
- it 'contains an imsnanifest.xml and an assessment.xml files' do
44
- dir = Dir.mktmpdir
45
-
46
- exporter = Qti::Exporter.new(assessment_test, package_root_path: dir)
47
- exporter.export
48
-
49
- Zip::File.open(exporter.exported_file_path, 'r') do |zip_file|
50
- expect(zip_file.glob('imsmanifest.xml').first).to be_present
51
- expect(zip_file.glob('assessment.xml').first).to be_present
52
- expect(zip_file.glob('item-1.xml').first).to be_present
53
- end
54
- end
55
- end