मैं यह सुनिश्चित करना चाहता हूं कि मेरे सीएसवी डाउनलोड में सही कॉलम हों। जब मैं आरएसपीसी के साथ एक सीएसवी डाउनलोड का परीक्षण करता हूं तो मैं फ़ाइल सामग्री तक नहीं पहुंच सकता। मैं CSV फ़ाइल की सामग्री तक कैसे पहुंचूं?रुपयेपेक परीक्षण सीएसवी फ़ाइल डाउनलोड
require 'spec_helper'
include Devise::TestHelpers
describe Admin::ApplicationsController do
before(:each) do
@application = FactoryGirl.create :application
@user = FactoryGirl.create(:admin_user)
sign_in @user
end
it "downloads a csv"
it "gives us only the columns we want" do
get :index, format: :csv
p response.body
p response.headers
end
end
परीक्षण के उत्पादन:
# This is the output in the terminal
# ""
# {"Content-Type"=>"text/csv; charset=utf-8", "Content-Disposition"=>"attachment; filename=\"applications-2013-12-17.csv\""}