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

Streamline access condition mapping tests for Cocina>MODS direction #461

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
119 changes: 4 additions & 115 deletions spec/cocina/models/mapping/descriptive/mods/access_condition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

RSpec.describe 'MODS accessCondition <--> cocina mappings' do
describe 'Restriction on access type' do
describe 'Access condition with type' do
it_behaves_like 'MODS cocina mapping' do
let(:mods) do
<<~XML
Expand All @@ -26,121 +26,11 @@
end
end

describe 'Restriction on access type without spaces' do
describe 'Access condition without type' do
it_behaves_like 'MODS cocina mapping' do
let(:mods) do
<<~XML
<accessCondition type="restrictionOnAccess">Available to Stanford researchers only.</accessCondition>
XML
end

let(:roundtrip_mods) do
<<~XML
<accessCondition type="restriction on access">Available to Stanford researchers only.</accessCondition>
XML
end

let(:cocina) do
{
access: {
note: [
{
value: 'Available to Stanford researchers only.',
type: 'access restriction'
}
]
}
}
end
end
end

describe 'Restrictions on access type without spaces' do
it_behaves_like 'MODS cocina mapping' do
let(:mods) do
<<~XML
<accessCondition type="restrictionsOnAccess">Available to Stanford researchers only.</accessCondition>
XML
end

let(:roundtrip_mods) do
<<~XML
<accessCondition type="restriction on access">Available to Stanford researchers only.</accessCondition>
XML
end

let(:cocina) do
{
access: {
note: [
{
value: 'Available to Stanford researchers only.',
type: 'access restriction'
}
]
}
}
end
end
end

describe 'Restriction on use and reproduction type' do
it_behaves_like 'MODS cocina mapping' do
let(:mods) do
<<~XML
<accessCondition type="use and reproduction">User agrees that, where applicable, blah blah.</accessCondition>
XML
end

let(:cocina) do
{
access: {
note: [
{
value: 'User agrees that, where applicable, blah blah.',
type: 'use and reproduction'
}
]
}
}
end
end
end

describe 'Restriction on use and reproduction type without spaces' do
it_behaves_like 'MODS cocina mapping' do
let(:mods) do
<<~XML
<accessCondition type="useAndReproduction">User agrees that, where applicable, blah blah.</accessCondition>
XML
end

let(:roundtrip_mods) do
<<~XML
<accessCondition type="use and reproduction">User agrees that, where applicable, blah blah.</accessCondition>
XML
end

let(:cocina) do
{
access: {
note: [
{
value: 'User agrees that, where applicable, blah blah.',
type: 'use and reproduction'
}
]
}
}
end
end
end

describe 'License' do
it_behaves_like 'MODS cocina mapping' do
let(:mods) do
<<~XML
<accessCondition type="license">CC by: CC BY Attribution</accessCondition>
<accessCondition>Available to Stanford researchers only.</accessCondition>
XML
end

Expand All @@ -149,8 +39,7 @@
access: {
note: [
{
value: 'CC by: CC BY Attribution',
type: 'license'
value: 'Available to Stanford researchers only.'
}
]
}
Expand Down