I have a case where I want to test a file upload but I'm having problems breaking a circle of pain.
We are checking that the file uploaded is a CSV file, so the file should have the extention .csv.
To test we need to use ActionDispatch::TestProcess.fixture_file_upload and we place the test file in the test/fixtures/files diectory.
Now when I try to run a test, Rails sees this csv file in the sub-folder of fixtures and thinks it should use the file to populate some table. Which is wrong.
Is there any way I can tell Rails not to try and use this file for populating a table?
- I can't rename the extension as that is what I'm trying to test.
- I can't move the file out of fixtures as then the fixture_file_upload won't work
- I can't seem to tell Rails to leave this file alone when populating fixture data.
:(