Rename CsvExportLog to UserExport

This commit is contained in:
Arpit Jalan
2014-12-28 21:43:49 +05:30
parent 8d03ff6f82
commit 68e66f3a25
6 changed files with 28 additions and 23 deletions

View File

@ -22,11 +22,11 @@ describe ExportCsvController do
describe ".download" do
it "uses send_file to transmit the export file" do
file = CsvExportLog.create(export_type: "user", user_id: @user.id)
file = UserExport.create(export_type: "user", user_id: @user.id)
file_name = "export_#{file.id}.csv"
controller.stubs(:render)
export = CsvExportLog.new()
CsvExportLog.expects(:get_download_path).with(file_name).returns(export)
export = UserExport.new()
UserExport.expects(:get_download_path).with(file_name).returns(export)
subject.expects(:send_file).with(export)
get :show, id: file_name
response.should be_success
@ -38,7 +38,7 @@ describe ExportCsvController do
end
it "returns 404 when the export file does not exist" do
CsvExportLog.expects(:get_download_path).returns(nil)
UserExport.expects(:get_download_path).returns(nil)
get :show, id: export_filename
response.should be_not_found
end
@ -59,18 +59,18 @@ describe ExportCsvController do
describe ".download" do
it "uses send_file to transmit the export file" do
file = CsvExportLog.create(export_type: "admin", user_id: @admin.id)
file = UserExport.create(export_type: "admin", user_id: @admin.id)
file_name = "export_#{file.id}.csv"
controller.stubs(:render)
export = CsvExportLog.new()
CsvExportLog.expects(:get_download_path).with(file_name).returns(export)
export = UserExport.new()
UserExport.expects(:get_download_path).with(file_name).returns(export)
subject.expects(:send_file).with(export)
get :show, id: file_name
response.should be_success
end
it "returns 404 when the export file does not exist" do
CsvExportLog.expects(:get_download_path).returns(nil)
UserExport.expects(:get_download_path).returns(nil)
get :show, id: export_filename
response.should be_not_found
end