Browse Source

Check CSV only downloads collection

pull/441/head
baarkerlounger 3 years ago
parent
commit
d4312f42cf
  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
expect(page).to have_title("Logs")
end
end
it "shows the download csv link" do
expect(page).to have_link("Download (CSV)", href: "/logs.csv")
end
end
context "when there are more than 20 logs" do
before do
@ -415,15 +415,20 @@ RSpec.describe CaseLogsController, type: :request do
before do
sign_in user
FactoryBot.create(:case_log)
get "/logs", headers: headers, params: {}
end
it "downloads a CSV file with headers" do
csv = CSV.parse(response.body)
expect(csv.count).to eq(2)
expect(csv.first.first).to eq("id")
expect(csv.second.first).to eq(case_log.id.to_s)
end
it "does not download other orgs logs" do
csv = CSV.parse(response.body)
expect(csv.count).to eq(2)
end
end
describe "PATCH" do

Loading…
Cancel
Save