Skip to content

Commit

Permalink
Merge pull request #1232 from sul-dlss/linked-series-wo-links
Browse files Browse the repository at this point in the history
Do not attempt to link nil link values in MARC series data
  • Loading branch information
ndushay committed Feb 29, 2016
2 parents a4c5074 + c5505c7 commit 7989972
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/views/marc_fields/_linked_series.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<dt><%= linked_series.label %></dt>
<% linked_series.values.each do |series| %>
<dd>
<%= link_to(series[:link].strip, catalog_index_path(q: "\"#{series[:link].strip}\"", search_field: 'search_series')) %> <%= series[:extra_text] %>
<% if series[:link] %>
<%= link_to(series[:link].strip, catalog_index_path(q: "\"#{series[:link].strip}\"", search_field: 'search_series')) %>
<% end %>
<%= series[:extra_text] %>
</dd>
<% end %>
18 changes: 17 additions & 1 deletion spec/views/marc_fields/_linked_series.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@
end

it 'included the extra text after the link' do
expect(subject).to have_css('dd', text: 'The Link Value Some other text')
expect(subject).to have_css('dd', text: /The Link Value\s+Some other text/)
end

context 'when a link is not present' do
let(:linked_series) do
double(
'LinkedSeries',
label: 'Series',
values: [
{ extra_text: 'Some other text' }
]
)
end

it 'successfully renders just the extra text' do
expect(subject).to have_css('dd', text: 'Some other text')
end
end
end

0 comments on commit 7989972

Please sign in to comment.