-
Notifications
You must be signed in to change notification settings - Fork 0
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
Nested factory references don't play well with the prefix #3
Comments
Can you show me the That said, it would be nice if For example: with_namespace(:Testing, require_prefix: false) do
define :user do
office
end
end Unpacked to something like: with_namespace(:Testing, require_prefix: false) do
define :user do
office { association(:office, factory: :testing_office) }
end
end So that if you have |
Yeah sorry that was just me sketching the issue out, I got rid of the code but it was something to the effect of But again that's just off the top of my head, it wasn't exactly that, but a mechanism to switch prefix off for engine dev.
Yes exactly. |
@zspencer I'm having a little trouble running the tests, is this an activerecord version issue? I'm running through bundler so it's using the versions in the lock file.
Or perhaps a ruby version issue? |
I had the same issue on Ruby 3.1; which is why I loosened the Gemfile dependencies. (Also maybe these should be development dependencies? It's been a while since I've futzed with a Real Gem ™️ rather than just gem(s) in a monolith.) Note: the Lockfile is not checked in, so you should be able to bundle update and not impact anyone else. |
Perhaps! Honestly I mostly pretend to know what I'm doing when making gems.
👍🏻 |
I don't know for sure if this is an issue since I quickly chose a different option to keep development going, but during my first tries it seemed like the concept of "no prefix for in-engine tests, prefix for apps using the engine" doesn't quite work because if you reference another factory from within your factory (like when it's inferred from an association) then there's a mismatch.
e.g. for an engine called
Testing
When you're working within the engine then creating a
:user
creates an:office
just fine, but outside the engine, creating a:testing_user
fails because there's no:office
defined (because it's now:testing_office
).Does that jive with your experience or did I mess up somewhere? I can take a look at a fix otherwise.
The text was updated successfully, but these errors were encountered: