rubocop / rubocop-rspec

Code style checking for RSpec files.
https://docs.rubocop.org/rubocop-rspec
MIT License
811 stars 276 forks source link

Add `#traits_for_enum` to `RuboCop::RSpec::FactoryBot.reserved_methods` #943

Closed harrylewis closed 4 years ago

harrylewis commented 4 years ago

Thank you for building and maintaining rubocop-rspec. My team uses this and a lot of the defaults are pretty sensible, and help us to write cleaner tests!

FactoryBot recently released version 6.0.0, which introduces a new method to use within a factory definition, #traits_for_enum. Using this causes Rubocop to flag it with FactoryBot/AttributeDefinedStatically. This issue stems from the fact that this new method is not included in Rubocop::RSpec::FactoryBot.reserved_methods.

https://github.com/rubocop-hq/rubocop-rspec/blob/fad338729759334cb7411802e54cdf84f0e685c4/lib/rubocop/rspec/factory_bot.rb#L37-L40

A simple fix would be to include this reserved method in the list. I don't mind creating a PR for this.

Curious to hear your thoughts!

pirj commented 4 years ago

Hey! Thanks for bringing this up. Sure, a pull request is welcome.