Skip to content

Commit

Permalink
Added a test for GuideCard card images
Browse files Browse the repository at this point in the history
Co-authored-by: Jane Sandberg <[email protected]>
  • Loading branch information
2 people authored and hackartisan committed Sep 29, 2023
1 parent fb90ef0 commit a38160c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/guide_cards_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ def search
def show
@guide_card = GuideCard.find(params[:id])
@sub_guide_cards = @guide_card.children
@card_images = CardImage.where(path: @guide_card.path)
end
end
6 changes: 6 additions & 0 deletions app/views/guide_cards/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
<li> <%= link_to sub_guide.heading, sub_guide_card_path(sub_guide.id) %> </li>
<% end %>
</ul>

<% @card_images.each do |image| %>
<ul>
<%= image_tag(image.iiif_url, alt: "Catalog Card") %>
</ul>
<% end %>
12 changes: 12 additions & 0 deletions spec/system/guide_cards_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,16 @@
expect(page).to have_text 'Manuscripts'
end
end

describe 'show page' do
it 'displays card images' do
ci = CardImage.new
ci.path = GuideCard.find(2).path
ci.image_name = 'imagecat-disk1-0675-B1764-0000.0219.tif'
ci.save
visit '/guide_cards/2'
expect(page).to have_selector('img')
expect(page).to have_selector('img[alt]')
end
end
end

0 comments on commit a38160c

Please sign in to comment.