I have a page where the user uploads a file (we are using Refile). Now I have a test something like the following
attach_file :file_upload, Rails.root + "spec/fixture/pdf.pdf"
click_button "Upload"
then I check that there should be a success message
expect(page).to have_css("css class here")
I tried displaying the page body that is being rendered to check what flash message is being rendered. It always gives me "Attachment is required".