Skip to content

Commit

Permalink
[WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
AgaDufrat committed Dec 28, 2023
1 parent 8088b75 commit 863d48f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/workers/content_item_populate_doctype_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def perform
content_store = GdsApi::ContentStore.new(Plek.find("content-store"))
document_type_errors = []

ContentItem.all.find_each do |content_item|
ContentItem.find_each do |content_item|
found_content_item = content_store.content_item(content_item.path)

document_type = found_content_item["document_type"]
Expand Down
5 changes: 3 additions & 2 deletions spec/workers/content_item_populate_doctype_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
include GdsApi::TestHelpers::ContentStore

it "updates every content item's `document_type`" do
content_item = double("ContentItem", path: "foo")
allow(ContentItem).to receive(:all).and_return([content_item])
content_item = create(:content_item, path: "foo")
content_items = ContentItem.where(id: content_item.id)
allow(ContentItem).to receive(:find_each).and_return(content_items)
mock_content_store = double("ContentStore", content_item: { "document_type" => "foo_doctype" })
allow(GdsApi::ContentStore).to receive(:new).and_return(mock_content_store)

Expand Down

0 comments on commit 863d48f

Please sign in to comment.