Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pfg scaffolding #4650

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Remove pfg scaffolding #4650

wants to merge 10 commits into from

Conversation

KludgeKML
Copy link
Contributor

@KludgeKML KludgeKML commented Feb 19, 2025

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

What

Remove PfG scaffolding code

Why

PfG is now live, so we don't need the scaffolding that was necessary to test it before go-live. The ability to load content items from the local path has been

Relies on / Cannot be merged before: alphagov/publishing-api#3153

…ntItemFactory

- this helps make sure that it's always a GdsApi::Response that's presented to the factory in tests.
- We now no longer want to render anything when a content item doesn't exist, so we leave that to standard behaviour.
- Our example now contains an attachment, so we don't need to
  specifically stub it.
- Our example now contains an attachment and details, so we
  don't need to stub them here.
- We're now no longer calling the content item with an optional
  additional hash anywhere (it was for landing page items, which now
  don't need it).
- Now that the initializer for the base content item doesn't have the
  optional params, we can simplify all super calls in derived models.
Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a great that the scaffolding is being removed. 🎉

I have a couple of inline comments / suggestions.

before do
stub_const("LandingPage::ADDITIONAL_CONTENT_PATH", "spec/fixtures")
end
subject(:landing_page) { content_item_from_factory(content_item_hash:) }
Copy link
Contributor

@leenagupte leenagupte Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do the landing page examples need to be called through content_item_from_factory when the tests for the other document types don't?

They are also pulling examples from content schemas, but are calling described_class.new for example this is what we added in the mobbing session:

subject(:content_item) { described_class.new(content_store_response) }

@content_store_response = content_store_response
@content_store_hash = override_content_store_hash || content_store_response.to_hash
@content_store_hash = content_store_response.to_hash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is content_store_hash needed now? I'm sure that before the scaffolding was added, we were just using content_store_response directly.

I think we should go back to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants