-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
factory_girl_rails/factory_bot_rails RuntimeError: can't modify frozen Array #247
Comments
@torntrousers to confirm, pre-rename, you were not seeing this error, correct? Out of curiosity, is it possible you could provide the git diff from your change? If you're on a Mac, you should be able to run Another possible culprit: you had a file with the name Without being able to see what changed, it's difficult to nail down what the issue is, but those are the two places I'd start. |
Yes the tests work fine if I change it all back to factory-girl. Here is the git diff:
and
|
@torntrousers ah, excellent; can you check to see what changed in |
|
@torntrousers ah, apologies - I missed this when you posted the diff. There's nothing that's immediately obvious to me as actively causing this. Can you provide what command (or commands, if you're able to reproduce in other ways) that trigger this exception? (e.g. were you running The fact it travels all the way back to the application, which runs |
After doing bundle install to get the error i do "bin/rake parallel:spec". |
Sorted!
Something like this grep looks like it fixes it: |
@torntrousers ah, excellent! I hadn't thought to ask about if other constants existed; I'd actually just attempted to recreate by adding parallel_tests to a repo 😃 to see if that was involved. I'm glad to hear it! We ended up updating the command suggested in the upgrade doc since some people won't have rakefiles that include it (so, we added the I'm glad to hear it worked out, and thanks for your patience while we debugged; without access to the codebase, these problems are always a bit trickier! |
This same issue seems to have happened to us on the update from 4.10.0 to 4.11.0, although the releases show "No notable changes" We literally changed the version number and bundled. |
@JalisoCSP did any other gems get bumped in the upgrade? Can you provide a backtrace, and perhaps the line(s) that seem to be causing the problem? |
@joshuaclayton - Fast response! There was a few, but we've since narrowed it down to this gem being bumped - eg; we took this upgrade out and everything was fine.
(Edit: tag) |
@JalisoCSP is there further backtrace you can provide? There's nothing obvious/unique here that would point to FB - or really anything else - directly, so it's hard to provide any suggestions right now. |
@joshuaclayton nothing too useful, I'm afraid. Here it is, in case it helps:
This is on Rails 5.2.1 and Ruby 2.5.1 (Edits: Bad copy and paste when removing long [gem path] 👍) |
Having the same problem after changing to FactoryBot from FactoryGirl and NOTE: if you get this test error, the very first test error will give you more details on what's breaking. |
In my case issue was caused by rails_admin recent upgrade:
|
How did you resolve this? I've been struggling with the same error |
We never did. We're still on 4.10.0 CC: @Mohakjuneja |
This happened to me when I declared two factories w/ the same name. |
See #303 (comment) for more details |
I had the same problem when tried to upgrade from |
@nezirz there were some deprecations in factory_bot 4.11, so you will want to upgrade to that version and deal with the warnings before upgrading to factory_bot 5.0. |
Great tip @composerinteralia. basically to solve this issue:
The errors with 5.0 occur because of the deprecation of static var in factories. Gl all. |
Thanks a lot, this helped to solve problem! |
I was getting the same error. I fixed by removing require 'rails_helper' from spec files. It was causing the issue for me. I am not sure but it seems somewhere it was trying to load these helpers multiple time and it was causing can't modify frozen Array. |
In my case, just changed my factory field from |
worked for me |
I've followed the instructions in the blog post about how to make the factory_girl_rails/factory_bot_rails rename and now tests fail with 'can't modify frozen Array', eg:
I'm totally new to rails and Ruby so likely a user error, but what? Any pointers on what I'm doing wrong?
Thanks!
The text was updated successfully, but these errors were encountered: