Spreewald: Content-Disposition not set when testing a download's filename
- The file is served from a public folder (not via controller)
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 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 step:
Then I should get a response with content-type "..."
- Look at the link of the url and check if this file exists in your public folder (Example for an image)
Server via controller
- Write an own step which downloads the file and then makes tests with it (you can not check the url because this would be something like
- Override the
send_filemethod 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