diff --git a/app/views/projects/_latest_download_link.html.erb b/app/views/projects/_latest_download_link.html.erb index 47139016..c01165ee 100644 --- a/app/views/projects/_latest_download_link.html.erb +++ b/app/views/projects/_latest_download_link.html.erb @@ -1 +1 @@ -<%= link_to("Download latest report - generated #{time_ago_in_words(@latest_completed_download.completion_time)} ago", project_file_list_download_path(@latest_completed_download.id, target: "_blank")) %> \ No newline at end of file +<%= link_to("Download latest report - generated #{time_ago_in_words(@latest_completed_download.completion_time)} ago", project_file_list_download_path(job_id: @latest_completed_download.job_id, target: "_blank")) %> \ No newline at end of file diff --git a/spec/system/project_details_spec.rb b/spec/system/project_details_spec.rb index d4b49d23..0184158d 100644 --- a/spec/system/project_details_spec.rb +++ b/spec/system/project_details_spec.rb @@ -212,16 +212,13 @@ context "when downloads exist" do before do - FileInventoryRequest.create!(user_id: sponsor_user.id, project_id: project.id, job_id: 123, state: UserRequest::COMPLETED, - request_details: { project_title: project.title }, completion_time: 5.days.ago) - FileInventoryRequest.create!(user_id: sponsor_user.id, project_id: project.id, job_id: 456, state: UserRequest::COMPLETED, - request_details: { project_title: project.title }, completion_time: 2.days.ago) + FileInventoryJob.new(user_id: sponsor_user.id, project_id: project.id).perform_now end it "includes a link to the latest download in the download modal" do sign_in sponsor_user visit "/projects/#{project.id}" click_on("Download Complete List") - expect(page).to have_content("Download latest report - generated 2 days ago") + expect(page).to have_content("Download latest report - generated less than a minute ago") end end end