Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Digital Object Export #66

Draft
wants to merge 2 commits into
base: digital_object_edit
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions staff_features/digital_objects/digital_object_export.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: Digital Object Export
Background:
Given an administrator user is logged in
And a Digital Object has been created
And the Digital Object is opened in edit mode
Scenario: Digital Object export MODS
When the user clicks on 'Export'
And the user clicks on 'Download MODS' in the dropdown menu
Then a MODS XML file is downloaded
Scenario: Digital Object export METS
When the user clicks on 'Export'
And the user clicks on 'Download METS' in the dropdown menu
Then a METS XML file is downloaded
Scenario: Digital Object export DC
When the user clicks on 'Export'
And the user clicks on 'Download DC' in the dropdown menu
Then a DC XML file is downloaded
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

Then 'a MODS XML file is downloaded' do
files = Dir.glob(File.join(Dir.tmpdir, '*__mods.xml'))

downloaded_file = nil
files.each do |file|
downloaded_file = file if file.include?("Digital_Object_Identifier_#{@uuid}".gsub('-', ''))
end

expect(downloaded_file).to_not eq nil

file_string = File.read(downloaded_file)

expect(file_string).to include '<mods version="3.4" xmlns="http://www.loc.gov/mods/v3">'
expect(file_string).to include "<title>Digital Object Title #{@uuid}</title>"
end

Then 'a METS XML file is downloaded' do
files = Dir.glob(File.join(Dir.tmpdir, '*__mets.xml'))

downloaded_file = nil
files.each do |file|
downloaded_file = file if file.include?("Digital_Object_Identifier_#{@uuid}".gsub('-', ''))
end

expect(downloaded_file).to_not eq nil

file_string = File.read(downloaded_file)

expect(file_string).to include '<mets xmlns="http://www.loc.gov/METS/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/METS/ https://www.loc.gov/standards/mets/mets.xsd">'
expect(file_string).to include "<mods:title xmlns:mods=\"http://www.loc.gov/mods/v3\">Digital Object Title #{@uuid}</mods:title>"
end

Then 'a DC XML file is downloaded' do
files = Dir.glob(File.join(Dir.tmpdir, '*__dc.xml'))

downloaded_file = nil
files.each do |file|
downloaded_file = file if file.include?("Digital_Object_Identifier_#{@uuid}".gsub('-', ''))
end

expect(downloaded_file).to_not eq nil

file_string = File.read(downloaded_file)

expect(file_string).to include '<dc xmlns="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://purl.org/dc/elements/1.1/ https://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd http://purl.org/dc/terms/ https://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd">' # rubocop:disable Layout/LineLength:
expect(file_string).to include "<title>Digital Object Title #{@uuid}</title>"
end
Loading