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
Fresh pass at displaying more detail during linting #707
Conversation
factories_to_lint.inject({}) do |result, factory| | ||
begin | ||
FactoryGirl.create(factory.name) | ||
rescue => e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e
=> error
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 896ae8b
Worth including the exception class name? Looks good, generally. Ready to merge at your discretion. |
@jferris the exception's class name could be valuable - especially if the message itself is ambiguous. I've changed the output to:
Thoughts? |
maybe a parenthetical after the factory with the exception class name, with the message underneath?
|
I'm guessing all on one line is generally okay. Would make it more convenient for things like grep anyway. |
ca451af
to
f451e4a
Compare
This new behavior is inconsistent with the .lint documentation. Calling .create on any factory with dependent records is going to violate foreign key constraints. |
@silatham99 I've updated docs to better reflect how linting operates. The intention of Factory Girl is to be able to create data, so defined factories should in fact be able to be created. |
Since thoughtbot/factory_bot#707 the linter now calls create on each factory, and this was polluting the database. Wrapping this in a transaction that's rolled back prevents this.
Since thoughtbot/factory_bot#707 the linter now calls create on each factory, and this was polluting the database. Wrapping this in a transaction that's rolled back prevents this.
Since thoughtbot/factory_bot#707 the linter now calls create on each factory, and this was polluting the database. Wrapping this in a transaction that's rolled back prevents this.
Closes #692, #664, #696, #691