Skip to content

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

@harrylewis

Description

@harrylewis

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!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions