-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Upgrading to 5.0.0 breaks all RSpec tests #315
Comments
That may be related to #303. |
Same here. I (finally) did the upgrade process from |
@kofronpi if you are coming from factory_girl I would recommend upgrading to factory_bot 4.11.1 first so you can catch any deprecation warnings. |
Yes, I downgraded to 4.10 (saw mention of the frozen array issue somewhere
else with 4.11) and it works now. Thanks !
…On Wed, Feb 6, 2019 at 3:08 PM Daniel Colson ***@***.***> wrote:
@kofronpi <https://github.com/kofronpi> if you are coming from
factory_girl I would recommend upgrading to factory_bot 4.11.1 first so you
can catch any deprecation warnings.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#315 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS2THzHTy5H2aGjtJny7sddEHqrlxzPks5vKuHBgaJpZM4afPVt>
.
|
OK, if you do plan on upgrading later, my experience with that Frozen Array issue is that if you run just a single test you will get the "real" error message. I once traced through why we end up with a Frozen Array error instead of the underlying factory_bot error, if that helps at all: #303 (comment) |
Ended up going back this morning to try and figure out the issue when upgrading. So I ran an individual test like you suggested and got the "real" error message I was looking for:
Apparently in the newest version of FactoryBot, factory attribute values must be defined using bracket notation like so:
Without the brackets, you get an undefined method error for your attribute names. When you get multiple errors of this kind happening, it triggers a Frozen Array error instead. So using the curly-bracket notation in all of my factories allowed me to run all my tests again without issues. Also I was just reading through some of the FactoryBot docs and came across this:
So it makes sense that I was getting an error. |
Yup, static attributes were deprecated in 4.11 and then removed in 5.0 (you can read this blog post for more details on why). The deprecation warning in 4.11 mentions a rubocop-rspec cop that can help change all the static attributes to dynamic ones. Let me know if you run into any other problems! |
…y_bot 5 Use curly-bracket notation. Refs. - https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#static-attributes - https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11 - https://github.com/thoughtbot/factory_bot/blob/master/NEWS.md#500-february-1-2019 - thoughtbot/factory_bot_rails#315 (comment)
…y_bot 5 Use curly-bracket notation. Refs. - https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#static-attributes - https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11 - https://github.com/thoughtbot/factory_bot/blob/master/NEWS.md#500-february-1-2019 - thoughtbot/factory_bot_rails#315 (comment)
…y_bot 5 Use curly-bracket notation. Refs. - https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#static-attributes - https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11 - https://github.com/thoughtbot/factory_bot/blob/master/NEWS.md#500-february-1-2019 - thoughtbot/factory_bot_rails#315 (comment)
Static attributes (without a block) are no longer available in factory_bot 5. Refs. - https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#static-attributes - https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11 - https://github.com/thoughtbot/factory_bot/blob/master/NEWS.md#500-february-1-2019 - thoughtbot/factory_bot_rails#315 (comment)
After upgrading to 5.0.0, I receive the following error for all of my RSpec spec files:
Downgrading solves the issue, not sure what exactly is going on.
The text was updated successfully, but these errors were encountered: