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/spec
Daniel Colson 2b524b060d Raise more meaningful error for unregistered trait
Closes #970

In this code we are passing an implicit declaration `user`, rather than
the symbol `:user`:

```rb
factory :post do
  author factory: user
end
```

This will raise a confusing error:
`undefined method 'name' for :comment:Symbol`.

This is coming from the implicit declaration `#==` method,
called on lib/factory_bot/attribute_list.rb#56.
The method wasn't ever designed to compare against
objects of different classes. I added some tests for all the declaration
classes to handle being compared against other kinds of objects.

Co-authored-by: Dusan Orlovic <duleorlovic@gmail.com>
2018-10-31 12:50:39 -04:00
..
acceptance Raise more meaningful error for unregistered trait 2018-10-31 12:50:39 -04:00
factory_bot Raise more meaningful error for unregistered trait 2018-10-31 12:50:39 -04:00
support Rubocop: Fix Style/StringLiterals Offenses (#1216) 2018-10-07 21:45:51 -04:00
factory_bot_spec.rb Remove unnecessary spec_helper requires 2018-05-21 18:03:28 +01:00
spec_helper.rb Rubocop: Fix Style/StringLiterals Offenses (#1216) 2018-10-07 21:45:51 -04:00