-
Notifications
You must be signed in to change notification settings - Fork 17
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
Refactor contents list logic #3366
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hannako
force-pushed
the
contents_list_refactor_2
branch
from
October 15, 2024 10:22
a8932bb
to
30a93a2
Compare
The original implementation could result in the method returning nil rather than true or false. Which is unexpected, and has been a barrier to changing when and where we display contents lists because of confusing test failures.
hannako
force-pushed
the
contents_list_refactor_2
branch
from
October 15, 2024 10:42
30a93a2
to
6dbefab
Compare
hannako
force-pushed
the
contents_list_refactor_2
branch
from
October 15, 2024 10:58
9374fc0
to
35e0a8b
Compare
This test is to check that the contents method returns the memoised @contents when repeatedly called, rather than running line 10 https://github.com/alphagov/government-frontend/blob/6dbefab2ed477a6328f57227494b4561f811f239/app/presenters/content_item/contents_list.rb#L10 The original test checked if the code on line 11 was run, ie the contents_items method. But the content_items method is called in two places in this module, within both the contents method (which this test is testing) but also within the show_contents_items? method.This means changes to the show_contents_items? code unexpectedly breaks this test. This commit reduces the scope of the test so that unexpected test failures no longer occur.
hannako
force-pushed
the
contents_list_refactor_2
branch
from
October 15, 2024 10:59
35e0a8b
to
da0f7c1
Compare
CodeSonia
approved these changes
Oct 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just reads so much better! 🙌
beccapearce
approved these changes
Oct 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good! Easier to get than before
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The original implementation could result in the
show_contents_list?
method returning nilrather than true or false. Which is unexpected, and has been a barrier
to changing when and where we display contents lists (trello) because of confusing
test failures (#3361).