how to upload a file in capybara spec
First, you need to install capybara
gem by adding it to your Gemfile and running bundle install
. Then, require capybara/dsl
in your spec file and include Capybara::DSL
in your test class. Next, use the attach_file
method with the file input field's id, name, or label text to locate the file input field and attach the file. Finally, click the submit button or perform any other necessary actions to complete the file upload process.