I want to make sure my CSV download contain the correct columns. When I test a CSV download with RSpec I cannot access the file contents. How do I access the contents of the CSV
At your describe block call render_views
as in:
describe Admin::ApplicationsController do
render_views
... # all the other code
end
Calling render_views
instructs RSpec to render the view contents inside a controller spec. This is turned off by default because when you're running controller specs you usually don't care about the view contents and this makes your tests run faster.
You can see the official documentation for the latest Rails version here.