Rspec test CSV file download

后端 未结 1 1049
借酒劲吻你
借酒劲吻你 2021-02-20 00:45

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

1条回答
  •  北海茫月
    2021-02-20 00:57

    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.

    0 讨论(0)
提交回复
热议问题