File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
app/models/concerns/arclight
spec/models/concerns/arclight Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,12 @@ def extent
6565 end
6666
6767 def abstract_or_scope
68- first ( 'abstract_ssm' ) || first ( 'scopecontent_ssm' )
68+ if first ( 'abstract_ssm' )
69+ # EAD <abstract> may contain raw #PCDATA not wrapped in an HTML tag
70+ "<p>#{ first ( 'abstract_ssm' ) } </p>"
71+ else
72+ first ( 'scopecontent_ssm' )
73+ end
6974 end
7075
7176 def creator
Original file line number Diff line number Diff line change 4141 end
4242 end
4343
44+ describe '#abstract_or_scope' do
45+ let ( :document ) do
46+ SolrDocument . new ( abstract_ssm : 'I will be wrapped' , scopecontent_ssm : '<p>I am wrapped</p>' )
47+ end
48+
49+ it 'returns abstract_ssm wrapped in a <p> tag' do
50+ expect ( document . abstract_or_scope ) . to eq '<p>I will be wrapped</p>'
51+ end
52+
53+ context 'when abstract_ssm is not pressent' do
54+ let ( :document ) { SolrDocument . new ( scopecontent_ssm : '<p>I am wrapped</p>' ) }
55+
56+ it 'returns scopecontent_ssm' do
57+ expect ( document . abstract_or_scope ) . to eq '<p>I am wrapped</p>'
58+ end
59+ end
60+ end
61+
4462 describe 'digital objects' do
4563 let ( :document ) do
4664 SolrDocument . new (
You can’t perform that action at this time.
0 commit comments