Browse Source

Check CSV only downloads collection

pull/440/head
baarkerlounger 3 years ago
parent
commit
4a5d95c99f
  1. 9
      spec/requests/case_logs_controller_spec.rb

9
spec/requests/case_logs_controller_spec.rb

@ -205,11 +205,11 @@ RSpec.describe CaseLogsController, type: :request do
it "does not have pagination in the title" do it "does not have pagination in the title" do
expect(page).to have_title("Logs") expect(page).to have_title("Logs")
end end
end
it "shows the download csv link" do it "shows the download csv link" do
expect(page).to have_link("Download (CSV)", href: "/logs.csv") expect(page).to have_link("Download (CSV)", href: "/logs.csv")
end end
end
context "when there are more than 20 logs" do context "when there are more than 20 logs" do
before do before do
@ -497,15 +497,20 @@ RSpec.describe CaseLogsController, type: :request do
before do before do
sign_in user sign_in user
FactoryBot.create(:case_log)
get "/logs", headers: headers, params: {} get "/logs", headers: headers, params: {}
end end
it "downloads a CSV file with headers" do it "downloads a CSV file with headers" do
csv = CSV.parse(response.body) csv = CSV.parse(response.body)
expect(csv.count).to eq(2)
expect(csv.first.first).to eq("id") expect(csv.first.first).to eq("id")
expect(csv.second.first).to eq(case_log.id.to_s) expect(csv.second.first).to eq(case_log.id.to_s)
end end
it "does not download other orgs logs" do
csv = CSV.parse(response.body)
expect(csv.count).to eq(2)
end
end end
describe "PATCH" do describe "PATCH" do

Loading…
Cancel
Save