qti 0.8.0 → 0.8.1

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: 044af09f85a901e95087d04875f1e9ed9ca839b1
4
- data.tar.gz: f45ac251e55a0b1d6fd1543ea467c2998b39fbdd
3
+ metadata.gz: 5e8424c7b1aa08d8050b0ed6fb82a8bfee2e7273
4
+ data.tar.gz: 3c2364dbb089fe7d93ba4f371694f022c09aa483
5
5
  SHA512:
6
- metadata.gz: 2743141bed2c58ebfc8cb6527e5c778bf83950ab8cd49824b0067ddf8c0512deb4dfbeb50121547b66e77c0da12dd4eb527f00932c03f5671e71d6f96dfe47c7
7
- data.tar.gz: 86342ca278700988d623dfcce9b7d5aa34ba7ba2eb7d30872cac41f11b2bbafc8ef5ddf92b42ee135a51661829583765bba81c343226c8456aa477b1448033d0
6
+ metadata.gz: 47aa300244b6eb1b7bb9da7a195d14a5d504116806afdd7ef2272d764b2069446e4940df10f853954e5349b1438b4028458353aa75c868a13ffbe378d2159af5
7
+ data.tar.gz: efb24fab172368a48d0e52a6e8375cd7961e476b054382819b90a89df3fbf8ab6f83f1853b85cd9f89f0adb0acaa41d3e0082543556210fe8f9cdd61e134577f
@@ -45,10 +45,10 @@ module Qti
45
45
  new(path: path, package_root: package_root)
46
46
  end
47
47
 
48
- def initialize(path:, package_root: nil)
48
+ def initialize(path:, package_root: nil, html: false)
49
49
  @path = path
50
50
  set_package_root(package_root || File.dirname(path))
51
- @doc = parse_xml(File.read(path))
51
+ @doc = html ? parse_html(File.read(path)) : parse_xml(File.read(path))
52
52
  raise ArgumentError unless @doc
53
53
  end
54
54
 
@@ -68,6 +68,10 @@ module Qti
68
68
  Nokogiri.XML(xml_string, @path.to_s, &:noblanks)
69
69
  end
70
70
 
71
+ def parse_html(html_string)
72
+ Nokogiri.HTML(html_string, @path.to_s, &:noblanks)
73
+ end
74
+
71
75
  def remap_href_path(href)
72
76
  return nil unless href
73
77
  path = File.join(File.dirname(@path), href)
@@ -34,7 +34,7 @@ module Qti
34
34
  end
35
35
 
36
36
  def create_stimulus(stimulus_ref)
37
- Qti::V2::Models::StimulusItem.from_path!(stimulus_ref, @package_root)
37
+ Qti::V2::Models::StimulusItem.new(path: stimulus_ref, package_root: @package_root, html: true)
38
38
  end
39
39
  end
40
40
  end
@@ -80,7 +80,7 @@ describe Qti::V2::Models::AssessmentTest do
80
80
  it 'creates a stimulus from a given file' do
81
81
  stimulus_path = File.join(fixtures_path, 'no_assessment_XML', 'passages', '0cfd5cf7-2c91-4b35-a57a-9f5d1709f68f.html')
82
82
  stimulus = loaded_class.create_stimulus(stimulus_path)
83
- expect(stimulus.title).to eq 'El equipo de hockey te necesita!'
83
+ expect(stimulus.title).to eq '¡El equipo de hockey te necesita!'
84
84
  end
85
85
  end
86
86
  end
@@ -4,7 +4,7 @@ describe Qti::V2::Models::StimulusItem do
4
4
  let(:file_path) { File.join('spec', 'fixtures', 'no_assessment_XML', 'imsmanifest.xml') }
5
5
  let(:test_object) { Qti::V2::Models::NonAssessmentTest.from_path!(file_path) }
6
6
  let(:stimulus_ref) { test_object.stimulus_ref(test_object.assessment_items[1]) }
7
- let(:loaded_class) { described_class.from_path!(stimulus_ref) }
7
+ let(:loaded_class) { described_class.new(path: stimulus_ref, html: true) }
8
8
 
9
9
  it 'loads a stimulus ref' do
10
10
  expect do
@@ -13,12 +13,13 @@ describe Qti::V2::Models::StimulusItem do
13
13
  end
14
14
 
15
15
  it 'has the title' do
16
- expect(loaded_class.title).to eq 'El equipo de hockey te necesita!'
16
+ expect(loaded_class.title).to eq '¡El equipo de hockey te necesita!'
17
17
  end
18
18
 
19
19
  it 'has sanitized item_body' do
20
20
  expect(loaded_class.body).to include '<div'
21
21
  expect(loaded_class.body).to include 'Listen to the audio passage.'
22
+ expect(loaded_class.body).to include '¡'
22
23
  end
23
24
 
24
25
  it 'has the identifier used to identify it in manifest file' 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.8.0
4
+ version: 0.8.1
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-08-24 00:00:00.000000000 Z
12
+ date: 2017-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport