Skip to content

Commit 299a048

Browse files
committed
add more specs, fix bug
1 parent 72534e0 commit 299a048

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

lib/proformaxml/services/importer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def set_meta_data
9090
def set_extra_data
9191
submission_restrictions_node = @task_node.xpath('xmlns:submission-restrictions').first
9292
@task.submission_restrictions = convert_xml_node_to_json(submission_restrictions_node) unless submission_restrictions_node.nil?
93-
external_resources_node = @task_node.xpath('xmlns:external_resources').first
93+
external_resources_node = @task_node.xpath('xmlns:external-resources').first
9494
@task.external_resources = convert_xml_node_to_json(external_resources_node) unless external_resources_node.nil?
9595
grading_hints_node = @task_node.xpath('xmlns:grading-hints').first
9696
@task.grading_hints = convert_xml_node_to_json(grading_hints_node) unless grading_hints_node.nil?

spec/proformaxml/exporter_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@
436436
end
437437
end
438438

439-
context 'with external-resources' do
439+
context 'with external_resources' do
440440
subject(:exporter) { described_class.new(task:, custom_namespaces: [{prefix: 'foo', uri: 'urn:custom:foobar'}]) }
441441

442442
let(:task) { build(:task, :with_external_resources) }
@@ -454,7 +454,7 @@
454454
end
455455
end
456456

457-
context 'with grading-hints' do
457+
context 'with grading_hints' do
458458
let(:task) { build(:task, :with_grading_hints) }
459459

460460
it 'add grading-hints' do

spec/proformaxml/importer_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,30 @@
9898
end
9999
end
100100

101+
context 'when task has submission_restrictions' do
102+
let(:task) { build(:task, :with_submission_restrictions) }
103+
104+
it 'successfully imports the task' do
105+
expect(imported_task).to be_an_equal_task_as ref_task
106+
end
107+
end
108+
109+
context 'when task has external_resources' do
110+
let(:task) { build(:task, :with_external_resources) }
111+
112+
it 'successfully imports the task' do
113+
expect(imported_task).to be_an_equal_task_as ref_task
114+
end
115+
end
116+
117+
context 'when task has grading_hints' do
118+
let(:task) { build(:task, :with_grading_hints) }
119+
120+
it 'successfully imports the task' do
121+
expect(imported_task).to be_an_equal_task_as ref_task
122+
end
123+
end
124+
101125
context 'when task has an embedded text file' do
102126
let(:task) { build(:task, :with_embedded_txt_file) }
103127

0 commit comments

Comments
 (0)