-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathagent_export.rb
38 lines (28 loc) · 1.13 KB
/
agent_export.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# frozen_string_literal: true
Then 'an EAC-CPF XML file is downloaded' do
files = Dir.glob(File.join(Dir.tmpdir, '*.xml'))
first_part_of_uuid = @uuid.split('-').pop
downloaded_file = nil
files.each do |file|
downloaded_file = file if file.include?('__eac.xml') &&
file.include?(first_part_of_uuid)
end
expect(downloaded_file).to_not eq nil
load_file = File.read(downloaded_file)
expect(load_file).to include '<eac-cpf'
expect(load_file).to include '<entityType>person</entityType>'
expect(load_file).to include "<part localType=\"surname\">Agent #{@uuid}</part>"
end
Then 'a MARC XML file is downloaded' do
files = Dir.glob(File.join(Dir.tmpdir, '*.xml'))
first_part_of_uuid = @uuid.split('-').pop
downloaded_file = nil
files.each do |file|
downloaded_file = file if file.include?('__marc.xml') &&
file.include?(first_part_of_uuid)
end
expect(downloaded_file).to_not eq nil
load_file = File.read(downloaded_file)
expect(load_file).to include '<collection'
expect(load_file).to include "<subfield code=\"a\">Agent #{@uuid}</subfield>"
end