Skip to content

Commit

Permalink
Work relationships view should label link with presenter#to_s vs. pre…
Browse files Browse the repository at this point in the history
…senter#title.

Because the title method can return an array, and humans do not like looking at arrays.

Fixes #2148
  • Loading branch information
mjgiarlo committed Jun 6, 2016
1 parent 69e191e commit 47f316b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/curation_concerns/base/_relationships.html.erb
Expand Up @@ -11,7 +11,7 @@
<% collection_presenters.each do |collection| %>
<ul class="tabular">
<li class='attribute title'>
<%= link_to collection.title, main_app.collection_path(collection) %>
<%= link_to collection.to_s, main_app.collection_path(collection) %>
</li>
</ul>
<% end %>
Expand Down
Expand Up @@ -15,7 +15,7 @@
end

context "when collections are present" do
let(:collection_presenters) { [double(id: '456', title: 'Containing collection')] }
let(:collection_presenters) { [double(id: '456', title: ['Containing collection', 'foobar'], to_s: 'Containing collection')] }
let(:page) { Capybara::Node::Simple.new(rendered) }
before do
allow(presenter).to receive(:collection_presenters).and_return(collection_presenters)
Expand All @@ -24,5 +24,8 @@
it "links to collections" do
expect(page).to have_link 'Containing collection'
end
it "labels the link using the presenter's #to_s method" do
expect(page).not_to have_content 'foobar'
end
end
end

0 comments on commit 47f316b

Please sign in to comment.