Skip to content

Upgrade FactoryGirl to FactoryBot - #50768

Merged
Hamms merged 2 commits into
stagingfrom
factory_girl-to-factory_bot
Mar 17, 2023
Merged

Upgrade FactoryGirl to FactoryBot#50768
Hamms merged 2 commits into
stagingfrom
factory_girl-to-factory_bot

Conversation

@Hamms

@Hamms Hamms commented Mar 15, 2023

Copy link
Copy Markdown
Contributor

This gem was renamed, and the name we're using is no longer receiving updates.

Mostly just following the documentation at https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md:

git grep --name-only FactoryGirl | xargs sed -i "s/FactoryGirl/FactoryBot/"
git grep --name-only factory_girl | xargs sed -i "s/factory_girl/factory_bot/"

Also update from 4.7.0 to 4.8.2 while we're at it; no significant changes between those versions, and the Girl to Bot transition should be entirely seamless.

Links

Follow-up work

After this, we probably want to continue to update the version we target; at least to v4.11.1, possibly all the way to v6.x

Hamms added 2 commits March 14, 2023 18:43
Specifically target a version `>= 4.8.2` to prepare for a switch to `factory_bot_rails`, which this gem was renamed to.
Mostly just following the documentation at https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md:

```bash
git grep --name-only FactoryGirl | xargs sed -i "s/FactoryGirl/FactoryBot/"
git grep --name-only factory_girl | xargs sed -i "s/factory_girl/factory_bot/"
```
@Hamms
Hamms marked this pull request as ready for review March 15, 2023 23:54
@Hamms
Hamms requested review from a team March 15, 2023 23:55
@Hamms
Hamms merged commit c298cf2 into staging Mar 17, 2023
@Hamms
Hamms deleted the factory_girl-to-factory_bot branch March 17, 2023 00:18
@Hamms Hamms added the Rails Upgrade All work related to upgrading the version of Ruby on Rails we use. label Mar 22, 2023
Hamms added a commit that referenced this pull request Mar 22, 2023
The very latest version of the library, now that we can do so; follow-up to #50768. Specifically target a version `>= 6.2.0` to pick up support for Ruby 3.0, in preparation for an eventual update to that version: https://github.com/thoughtbot/factory_bot/releases/tag/v6.2.0
Hamms added a commit that referenced this pull request Apr 25, 2023
* Update `factory_bot` to 6.2.1

The very latest version of the library, now that we can do so; follow-up to #50768. Specifically target a version `>= 6.2.0` to pick up support for Ruby 3.0, in preparation for an eventual update to that version: https://github.com/thoughtbot/factory_bot/releases/tag/v6.2.0

* update add_attribute call to reflect deprecated static attributes

* remove deprecated FactoryBot.allow_class_lookup

* persist through association

* create rather than build enrollment object that we want to validate, so that its associated records are also persisted and able to be validated

* explicitly create some test records that need their associated records to be persisted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rails Upgrade All work related to upgrading the version of Ruby on Rails we use.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants