Fix analytics fixtures
What does this MR do and why?
Some fixtures were failing with the error ActiveRecord::RecordInvalid: Validation failed: Path has already been taken
. This was happening because we were using factories to create users, the same factory tries to create an organization for the user with the same path making the fixture no imdepotent.
Instead of using factories, we create the User
record directly in those seeds. This
is something we already do in many other fixtures.
How to set up and validate locally
Execute the following seeds and check if they succeed:
** Make sure to execute each twice if you have a pristine database**
FILTER=productivity_analytics SEED_PRODUCTIVITY_ANALYTICS=1 bundle exec rake db:seed_fu
FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu
FILTER=customizable_cycle_analytics SEED_CUSTOMIZABLE_CYCLE_ANALYTICS=1 bundle exec rake db:seed_fu
Other actions
We should probably remove the filter constants from these seeds making them run on every pipeline, this way we could catch errors like these earlier. It could be considered in a follow-up