Testing file uploads with Carrierwave


I want to write an application which enables a user to upload a PDF file
to our server.

I would like to develop this application using a test-driven approach
and the Rails default test suite.

However, I am not sure what I need to test and what I don’t need to

To elaborate: a user should be able to click on the “select file”
button, select a file and press “submit”. If the file is a PDF then it
will be uploaded to the server and written to the filesystem (as opposed
to a database), keeping its original name.
If the file is not a PDF, then an error message will be shown and the
form will be re-rendered.

I would be really grateful if someone could give me some pointers as to
what to test here and what not.

For example, would it be sensible to test that when a file is selected
and the form is submitted, that a file is actually uploaded? Or is this
something which would have been tested by the developpers of

Thanks in advance.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs