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

885 - Add tests for DefaultPetTask refactor #1053

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Aaryanpal
Copy link
Contributor

🔗 Issue

#885

✍️ Description

  • Added Test For Species Dog and Cat Assignment for DefaultPetTaskController

- Added Test For Species Dog and Cat Assignment for DefaultPetTaskController
default_pet_task: {name: "New Dog Task", species: "Dog", due_in_days: 5}
}
has_dog_species = DefaultPetTask.find_by_name("New Dog Task").Dog?
assert_equal true, has_dog_species
Copy link
Collaborator

@kasugaijin kasugaijin Oct 9, 2024

Choose a reason for hiding this comment

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

Ah so this is testing that it creates a new DefaultPetTask - but what I meant is that it creates a new Task on a new Pet.

If you look in app/services/organizations we have the DefaultPetTaskService which gets called when we create a new pet, and adds a Task for each DefaultPetTask for that species.
If you look in the Organizations::Staff::PetsController #create you will see we call the service on the new pet

So, to test, we want to

  • create the default pet task for dog
  • create a dog
  • verify that dog has a task with the same name as the default pet task for dogs
  • do the same for cat

does that make sense?

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.

2 participants