Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Refactor tests to use factories instead of fixtures #285

Merged
merged 28 commits into from
Nov 15, 2023

Conversation

dunkOnIT
Copy link
Collaborator

@dunkOnIT dunkOnIT commented Oct 19, 2023

TODO:

  • create factories
  • refactor validations into a service
  • check if we have all validations (just take a look for any validation functions missing from controller
  • change validate_update_request to use checker service, get old tests running
  • go through all old tests, make sure we have the cases covered (add them to a spreadsheet?)
  • once cases are covered, check files for commented out lines and puts statements
  • push and flag for review :)

@dunkOnIT
Copy link
Collaborator Author

dunkOnIT commented Nov 9, 2023

  • Need help resolving the lane_factory conflict
  • Just pushing the new stuff for now, will refactor the RSwag tests in a later PR

@dunkOnIT
Copy link
Collaborator Author

dunkOnIT commented Nov 10, 2023

  • Rewrite comeptitor_count function to (a) only consider registrations for one competition, (b) use where instead of all (consider using a nested query here)
  • Add tests for registration acceptance where different comps have different numbers of competitors
  • Make target_user_id = @request['user_id'].to_s as an instance variable in the functions, instead of calling it every time

Copy link
Member

@FinnIckler FinnIckler left a comment

Choose a reason for hiding this comment

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

as per call

@dunkOnIT
Copy link
Collaborator Author

dunkOnIT commented Nov 15, 2023

  • registration_spec.rb should query database to make sure that is_competing status change are persisting - we shouldn't just test the object in memory

@dunkOnIT dunkOnIT merged commit cf0aa61 into main Nov 15, 2023
1 check passed
@dunkOnIT dunkOnIT deleted the fixtures-to-factories branch November 15, 2023 13:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants