From c5791278b2ac1db12121599c1dc5d41e4f205746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 8 Sep 2021 01:00:23 +0200 Subject: [PATCH] Implement pending card image expectations --- spec/system/admin/widgets/cards_spec.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/system/admin/widgets/cards_spec.rb b/spec/system/admin/widgets/cards_spec.rb index ed299dd03..af4f215d2 100644 --- a/spec/system/admin/widgets/cards_spec.rb +++ b/spec/system/admin/widgets/cards_spec.rb @@ -207,6 +207,19 @@ describe "Cards", :admin do end end + scenario "Show image if it is present" do + card_1 = create(:widget_card, cardable: custom_page, title: "Card one") + card_2 = create(:widget_card, cardable: custom_page, title: "Card two") + + card_1.update!(image: create(:image, imageable: card_1, attachment: fixture_file_upload("clippy.jpg"))) + card_2.update!(image: nil) + + visit custom_page.url + + within(".card", text: "CARD ONE") { expect(page).to have_css "img" } + within(".card", text: "CARD TWO") { expect(page).not_to have_css "img" } + end + scenario "Edit" do create(:widget_card, cardable: custom_page, title: "Original title") @@ -247,8 +260,6 @@ describe "Cards", :admin do end end - pending "add image expectactions" - def attach_image_to_card click_link "Add image" attach_file "Choose image", file_fixture("clippy.jpg")