1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/lib/factory_bot/declaration
Daniel Colson f606018a78 Raise more helpful error for invalid attribute
Closes #1391

Along the same lines as #1286, this commit raises a more helpful error
if somebody passes an implicit declaration as an association argument.

Before this commit, an association with an implicit trait passed as an
override attribute:

```rb
person factory: :user, invalid_attribute: implicit_trait
```

Would raise an error `KeyError: Trait not registered: "implicit_trait"`.

This is potentially confusing, since the author probably didn't intend
to define an implicit trait.

After this commit, this will raise a more helpful error:

```
ArgumentError: Association 'person' received an invalid attribute override.
Did you mean? 'invalid_attribute}: :implicit_trait}'
```
2020-06-22 20:01:32 -04:00
..
association.rb Raise more helpful error for invalid attribute 2020-06-22 20:01:32 -04:00
dynamic.rb Raise more meaningful error for unregistered trait 2018-10-31 12:50:39 -04:00
implicit.rb Fix self referencing trait error (#1294) 2019-09-10 16:24:20 -07:00