I have a Scenario that validates that the image I just uploaded exists on the next page.
This below works great, except that I have a variable folder structure based on the listing_id. How can I use regex here to match image to only the filename instead of the entire url?
Then /^I should see the image "(.+)"$/ do |image|
page.should have_xpath("//img[@src=\"/public/images/#{image}\"]")
end
Try
page.should have_xpath("//img[contains(@src, \"#{image}\")]"), which will match anyimgwhosesrccontains your filename.