mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
![]() This has come up a few times, and I can see why it might be helpful to
have access to full backtraces when debugging a factory error uncovered
by `FactoryBot.lint`. But since most of the time I don't want the extra
noise from the backtrace, I added this as a verbose option.
The default message is still:
```
The following factories are invalid:
* user - undefined method `save!' for #<User:0x00007ff0cbc89100>
* admin - undefined method `save!' for #<User:0x00007ff0cbc73e40>
```
And with the verbose option (usually with more lines of backtrace):
```
The following factories are invalid:
* user - undefined method `save!' for #<User:0x00007ff0cbc89100>
/Users/.../thoughtbot/factory_bot/lib/factory_bot/evaluation.rb:18:in `create'
/Users/.../factory_bot/lib/factory_bot/strategy/create.rb:12:in `block in result'
* admin - undefined method `save!' for #<User:0x00007ff0cbc73e40>
/Users/.../thoughtbot/factory_bot/lib/factory_bot/evaluation.rb:18:in `create'
/Users/.../factory_bot/lib/factory_bot/strategy/create.rb:12:in `block in result'
```
I moved the linting option defaults out of the FactoryBot.lint method
and into keyword argument defaults in Linter#initialize. This seems a
bit cleaner, and now we will get an error if we pass an option we don't
understand (before
|
||
---|---|---|
.. | ||
attribute | ||
declaration | ||
decorator | ||
strategy | ||
syntax | ||
aliases.rb | ||
attribute.rb | ||
attribute_assigner.rb | ||
attribute_list.rb | ||
callback.rb | ||
callbacks_observer.rb | ||
configuration.rb | ||
declaration.rb | ||
declaration_list.rb | ||
decorator.rb | ||
definition.rb | ||
definition_hierarchy.rb | ||
definition_proxy.rb | ||
errors.rb | ||
evaluation.rb | ||
evaluator.rb | ||
evaluator_class_definer.rb | ||
factory.rb | ||
factory_runner.rb | ||
find_definitions.rb | ||
linter.rb | ||
null_factory.rb | ||
null_object.rb | ||
registry.rb | ||
reload.rb | ||
sequence.rb | ||
strategy_calculator.rb | ||
strategy_syntax_method_registrar.rb | ||
syntax.rb | ||
syntax_runner.rb | ||
trait.rb | ||
version.rb |