spec/models/europeana/blacklight/document_spec.rb in europeana-blacklight-1.2.2 vs spec/models/europeana/blacklight/document_spec.rb in europeana-blacklight-1.3.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'spec_helper'
require 'i18n'
RSpec.describe Europeana::Blacklight::Document do
subject { described_class.new(edm) }
@@ -9,20 +11,20 @@
let(:edm) do
{
id: '/abc/123',
type: 'IMAGE',
- title: ['title1', 'title2'],
+ title: %w(title1 title2),
proxies: [
{
about: '/proxy/provider/abc/123',
dcType: {
def: ['Image'],
en: ['Picture']
},
dcSubject: {
- def: ['music', 'art']
+ def: %w(music art)
},
dcDescription: {
en: ['object desc']
}
}
@@ -134,11 +136,11 @@
end
end
context 'when value is array' do
it 'returns array of values' do
- expect(subject['title']).to eq(['title1', 'title2'])
+ expect(subject['title']).to eq(%w(title1 title2))
end
end
context 'when value is absent' do
it 'does not raise an error' do
@@ -147,10 +149,10 @@
it 'returns nil' do
expect(subject['absent.key']).to be_nil
end
end
end
-
+
describe '#fetch' do
context 'when key is to relation' do
it 'handles 2-level keys' do
expect(subject.fetch('proxies.about')).to eq(['/proxy/provider/abc/123'])
end