format.csv respond_toからRSpecの中のファイルの内容を、私は私のコントローラに次のコードを持ってテストcsvファイルをエクスポート
...
def export
@filename = 'users.csv'
@output_encoding = 'UTF-8'
@users = User.active_users #not the actual scope but this only returns active
respond_to do |format|
format.csv
end
end
...
そして私は
it "should only return active users"
get :export, :format => :csv
# i want to check that my mocked users_controller#export is only returning the active users and not the inactive ones
end
response.body
私の仕様で、次のしています私はそれをチェックすると、このテストでは空です。このアクションがブラウザでヒットしたときにダウンロードされた仕様のcsvファイルを取得して、結果を確認できるようにするにはどうすればよいですか?私はこれを理解しようとする壁にちょっと打ちました。
ご協力いただきありがとうございます。