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

Add spec coverage for models/form/custom_emoji_batch class #28388

Merged

Conversation

mjankowski
Copy link
Contributor

Required adding another fabricator. Gets close to full coverage on the class, including the main action option paths through the save method. Pulled out a private method for the two ways of finding categories in the update action.

If we wanted more refactor - there is probably a way here to better aggragate the permissions checks up front, and/or group together the "pairsed" options (list/unlist, enable/disble) ... but I wanted to keep this coverage focused on this pass.

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1820bad) 83.49% compared to head (62b89a7) 83.67%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28388      +/-   ##
==========================================
+ Coverage   83.49%   83.67%   +0.18%     
==========================================
  Files        1038     1038              
  Lines       28245    28245              
  Branches     4558     4558              
==========================================
+ Hits        23584    23635      +51     
+ Misses       3534     3482      -52     
- Partials     1127     1128       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@renchap renchap added testing Automated lint and test suites ruby Pull requests that update Ruby code labels Dec 15, 2023
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

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

Can we do without the refactor? I'm afraid this could lead to different object shapes because the i-var would not be defined for every instance.

@mjankowski mjankowski force-pushed the spec-models-form-custom-emoji-batch branch from 766842c to 62b89a7 Compare December 18, 2023 12:19
@mjankowski
Copy link
Contributor Author

Can we do without the refactor? I'm afraid this could lead to different object shapes because the i-var would not be defined for every instance.

Removed the memoization method, just the specs now.

I believe in ruby 3.3 there's some improved performance/warning mode that you can run with to help identify SHAPE_TOO_COMPLEX classes -- may be worth running this either as a one-off audit, or regular part of CI?

@ClearlyClaire
Copy link
Contributor

I believe in ruby 3.3 there's some improved performance/warning mode that you can run with to help identify SHAPE_TOO_COMPLEX classes -- may be worth running this either as a one-off audit, or regular part of CI?

Yeah, that sounds like a good idea!

@ClearlyClaire ClearlyClaire added this pull request to the merge queue Dec 18, 2023
Merged via the queue into mastodon:main with commit af366f6 Dec 18, 2023
28 checks passed
@mjankowski mjankowski deleted the spec-models-form-custom-emoji-batch branch December 18, 2023 14:23
vmstan pushed a commit to vmstan/mastodon that referenced this pull request Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ruby Pull requests that update Ruby code testing Automated lint and test suites
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants