File tree 2 files changed +24
-1
lines changed
app/models/concerns/arclight
spec/models/concerns/arclight 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,12 @@ def extent
65
65
end
66
66
67
67
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
69
74
end
70
75
71
76
def creator
Original file line number Diff line number Diff line change 41
41
end
42
42
end
43
43
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
+
44
62
describe 'digital objects' do
45
63
let ( :document ) do
46
64
SolrDocument . new (
You can’t perform that action at this time.
0 commit comments