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

make metadata not show in the manifest if nil #74

Merged
merged 2 commits into from
Oct 3, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def setup_manifest_from_record(manifest, record)
manifest.label = ManifestBuilder.language_map(record.to_s) if record.to_s.present?
manifest.summary = ManifestBuilder.language_map(record.description) if record.try(:description).present?
manifest.behavior = viewing_hint if viewing_hint.present?
manifest.metadata = metadata_from_record(record)
manifest.metadata = metadata_from_record(record) if metadata_from_record(record).present?
manifest.viewing_direction = viewing_direction if viewing_direction.present?
manifest.service = services if search_service.present?
manifest.rendering = populate_rendering if populate_rendering.present?
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/iiif_manifest/v3/manifest_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def sequence_rendering

it 'does not have a metadata element' do
allow(book_presenter).to receive(:file_set_presenters).and_return([file_presenter])
expect(result['metadata']).to eq nil
expect(result.key?('metadata')).to be false
end
end

Expand All @@ -269,7 +269,7 @@ def sequence_rendering

it 'has no metadata' do
allow(book_presenter).to receive(:manifest_metadata).and_return(metadata)
expect(result['metadata']).to eq nil
expect(result.key?('metadata')).to be false
end
end

Expand Down Expand Up @@ -400,7 +400,7 @@ def sequence_rendering
expect(result['type']).to eq 'Manifest'
end
it "doesn't build manifests" do
expect(result['manifests']).to eq nil
expect(result.key?('metadata')).to be false
end
it 'builds items array from all the child file sets' do
expect(result['items'].length).to eq 2
Expand All @@ -427,7 +427,7 @@ def sequence_rendering
expect(result['type']).to eq 'Manifest'
end
it "doesn't build manifests" do
expect(result['manifests']).to eq nil
expect(result.key?('metadata')).to be false
end
it 'builds items array from all the child file sets' do
expect(result['items'].length).to eq 1
Expand Down