diff --git a/app/controllers/guide_cards_controller.rb b/app/controllers/guide_cards_controller.rb index 8cabe8a..cbd44f5 100644 --- a/app/controllers/guide_cards_controller.rb +++ b/app/controllers/guide_cards_controller.rb @@ -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 diff --git a/app/views/guide_cards/show.html.erb b/app/views/guide_cards/show.html.erb index 1a013f7..ce8f2ce 100644 --- a/app/views/guide_cards/show.html.erb +++ b/app/views/guide_cards/show.html.erb @@ -8,3 +8,9 @@
  • <%= link_to sub_guide.heading, sub_guide_card_path(sub_guide.id) %>
  • <% end %> + + <% @card_images.each do |image| %> + + <% end %> \ No newline at end of file diff --git a/spec/system/guide_cards_spec.rb b/spec/system/guide_cards_spec.rb index ccccae8..a2c6a53 100644 --- a/spec/system/guide_cards_spec.rb +++ b/spec/system/guide_cards_spec.rb @@ -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