Skip to content

Commit

Permalink
Adding reload of snapshot so readme that was uploaded displays (#1763)
Browse files Browse the repository at this point in the history
fixes #1734
  • Loading branch information
carolyncole authored Apr 15, 2024
1 parent c77fde6 commit 3e03569
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/works_wizard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def readme_uploaded
if readme_error.nil?
if params[:save_only] == "true"
@readme = readme.file_name
@work.reload_snapshots
render :readme_select
else
redirect_to work_attachment_select_url(@work)
Expand Down
3 changes: 3 additions & 0 deletions spec/controllers/works_wizard_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
describe "#readme_uploaded" do
let(:attach_status) { nil }
let(:fake_readme) { instance_double Readme, attach: attach_status, "blank?": true, file_name: "abc123" }
let(:fake_s3_service) { stub_s3 }
let(:params) do
{
"_method" => "patch",
Expand Down Expand Up @@ -109,10 +110,12 @@
let(:save_only_params) { params.merge(save_only: true) }

it "stays on the readme select page" do
fake_s3_service # make sure the stubs are in place
post :readme_uploaded, params: save_only_params
expect(response.status).to be 200
expect(fake_readme).to have_received(:attach)
expect(response).to render_template(:readme_select)
expect(fake_s3_service).to have_received(:client_s3_files)
end
end

Expand Down

0 comments on commit 3e03569

Please sign in to comment.