FEATURE: Log entity export in staff logs

This commit is contained in:
Vinoth Kannan
2018-09-19 03:16:45 +05:30
parent e95d6a12c5
commit 9281b72308
5 changed files with 32 additions and 2 deletions

View File

@ -30,6 +30,15 @@ describe ExportCsvController do
expect(response).to be_forbidden
expect(Jobs::ExportCsvFile.jobs.size).to eq(0)
end
it "correctly logs the entity export" do
post "/export_csv/export_entity.json", params: { entity: "user_archive" }
log_entry = UserHistory.last
expect(log_entry.action).to eq(UserHistory.actions[:entity_export])
expect(log_entry.acting_user_id).to eq(user.id)
expect(log_entry.subject).to eq("user_archive")
end
end
end
@ -58,6 +67,15 @@ describe ExportCsvController do
expect(job_data["entity"]).to eq("staff_action")
expect(job_data["user_id"]).to eq(admin.id)
end
it "correctly logs the entity export" do
post "/export_csv/export_entity.json", params: { entity: "user_list" }
log_entry = UserHistory.last
expect(log_entry.action).to eq(UserHistory.actions[:entity_export])
expect(log_entry.acting_user_id).to eq(admin.id)
expect(log_entry.subject).to eq("user_list")
end
end
end
end