If you deliver files from a public folder it might be that the Content-Disposition
header is not set. That's why the following
spreewald
Show archive.org snapshot
step might raise an error:
Then I should get a download with filename "..."
expected: /filename="some.pdf"$/
got: nil (using =~) (RSpec::Expectations::ExpectationNotMetError)
One solution is to check the Content-Type
header only with the following
spreewald
Show archive.org snapshot
step:
Then I should get a response with content-type "..."
How to test file downloads with tests that need javascript.
localhost:3000/users/4/avatar/3
)send_file
method of your controller (maybe application controller is also fine): If you are in the test suite return a text with the name of the file. Otherwise super
.