Testing images with RSpec
To test whether the right image is displayed on a page:
expect(page).to have_css("img[src*='image_name.png']")i.e. “Expect page to have an <img> tag whose src attribute contains the name of the required image.”
To test whether the right image is displayed on a page:
expect(page).to have_css("img[src*='image_name.png']")i.e. “Expect page to have an <img> tag whose src attribute contains the name of the required image.”