Skip to content

Commit

Permalink
Merge branch 'main' into mccalluc-work-activity-more-oo
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc committed Jan 13, 2023
2 parents 9669f2b + 36e0d46 commit b8162f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/works_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def show
@can_curate = current_user.can_admin?(@collection)
@work.mark_new_notifications_as_read(current_user.id)
end
format.json { render json: @work.resource }
format.json { render json: @work.to_json }
end
end

Expand Down
6 changes: 5 additions & 1 deletion spec/controllers/works_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@
expect(response.content_type).to eq "application/rss+xml; charset=utf-8"
end

it "renders the resource json" do
it "renders the work json" do
sign_in user
stub_s3
get :show, params: { id: work.id, format: "json" }
expect(response.content_type).to eq "application/json; charset=utf-8"
work_json = JSON.parse(response.body)
expect(work_json["resource"]).to_not be nil
expect(work_json["files"]).to_not be nil
expect(work_json["collection"]).to_not be nil
end

it "renders the new submission wizard' step 0" do
Expand Down
2 changes: 1 addition & 1 deletion spec/system/rss_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

# Fetching the JSON for an approved work doesn't require authentication
visit "/works/#{work1.id}.json"
expect(JSON.parse(page.body)["titles"][0]["title"]).to eq work1.title
expect(JSON.parse(page.body)["resource"]["titles"][0]["title"]).to eq work1.title

# Fetching the JSON for a work that is not yet approved doesn't work
visit "/works/#{work3.id}.json"
Expand Down

0 comments on commit b8162f5

Please sign in to comment.