Skip to content

Commit a38160c

Browse files
leefaisonrsandbergja
authored andcommitted
Added a test for GuideCard card images
Co-authored-by: Jane Sandberg <[email protected]>
1 parent fb90ef0 commit a38160c

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

app/controllers/guide_cards_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ def search
2323
def show
2424
@guide_card = GuideCard.find(params[:id])
2525
@sub_guide_cards = @guide_card.children
26+
@card_images = CardImage.where(path: @guide_card.path)
2627
end
2728
end

app/views/guide_cards/show.html.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88
<li> <%= link_to sub_guide.heading, sub_guide_card_path(sub_guide.id) %> </li>
99
<% end %>
1010
</ul>
11+
12+
<% @card_images.each do |image| %>
13+
<ul>
14+
<%= image_tag(image.iiif_url, alt: "Catalog Card") %>
15+
</ul>
16+
<% end %>

spec/system/guide_cards_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,16 @@
2929
expect(page).to have_text 'Manuscripts'
3030
end
3131
end
32+
33+
describe 'show page' do
34+
it 'displays card images' do
35+
ci = CardImage.new
36+
ci.path = GuideCard.find(2).path
37+
ci.image_name = 'imagecat-disk1-0675-B1764-0000.0219.tif'
38+
ci.save
39+
visit '/guide_cards/2'
40+
expect(page).to have_selector('img')
41+
expect(page).to have_selector('img[alt]')
42+
end
43+
end
3244
end

0 commit comments

Comments
 (0)