4217 eliminate checking factory items
Resolves #4217
Description
This PR aims to eliminate cases where specific values set by the various factories are tested against.
Optional fields were entirely removed from the factories where possible. When a field was necessary to initialize an object, it's value was set to something like "Dont test this", or a comment was added to specify the value shouldn't be tested against.
Tests which relied on these values and broke as a result of the above changes were updated to set their own values to test against.
There were two notable exceptions to this.
The first is the partner_profile factory. A Partner::Profile object may be initialized with a mismatch between the no_social_media_presence field and whether the website, twitter, facebook, or instagram fields are blank. However, many update requests which deal with Partner::Profile will fail validation if this is the case. It seemed reasonable for testers to assume the object returned by the factory would work with the object's requests, so the factory sets no_social_media_presence to true.
The second is the product_drive_participant factory. A ProductDriveParticipant object requires either a contact_name or a business_name and an email or a phone. I was not aware of any preference between the two, so I made the factory set a contact_name and an email and added a trait to nil these fields in cases where a tester wants to use only business_name and phone.
Lastly, the Geocoder configuration in rails_helpers.rb was updated to use a generic stub that will match any address. This was done to avoid the need to use highly specific addresses to get Geocoder to work in tests. In cases where more complicated Geocoder behavior is required, one can configure it in the test itself, like in donation_site_spec.rb.
Type of change
- Bug fix (non-breaking change which fixes an issue)
- Documentation update
How Has This Been Tested?
This PR updated existing tests and verified that the changed tests still passed..