capybara select file code example Example: how to upload a file in capybara spec attach_file("Upload Your File", Rails.root + "spec/fixtures/file.pdf")