This blog is part of our Rails 5 series.
While writing tests sometimes we need to read files to compare the output. For example a test might want to compare the API response with pre determined data stored in a file.
Here is an example.
File Fixtures in Rails 5
In Rails 5, we can now organize such test files as fixtures.
Newly generated Rails 5 applications,
will have directory
to store such test files.
These test files can be accessed
file_fixture helper method
file_fixture method returns
so it’s easy to extract file specific information.