Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive on RSpec/FactoryBot/CreateList cop #87

Closed
mkmn opened this issue Nov 17, 2023 · 0 comments · Fixed by #97
Closed

False positive on RSpec/FactoryBot/CreateList cop #87

mkmn opened this issue Nov 17, 2023 · 0 comments · Fixed by #97
Labels
bug Something isn't working

Comments

@mkmn
Copy link

mkmn commented Nov 17, 2023

Hello.
I found a false positive on RSpec/FactoryBot/CreateList cop when using traits.

Expected behavior

FactoryBot.define :user do
  age

  trait :admin
end

# good - contains a method call, may return different values
3.times { FactoryBot.create(:user, :admin, age: rand) }

Actual behavior

C: [Correctable] FactoryBot/CreateList: Prefer create_list.
3.times { FactoryBot.create(:user, :admin, age: rand) }
^^^^^^^
@pirj pirj added the bug Something isn't working label Nov 17, 2023
ydah added a commit that referenced this issue Jan 4, 2024
@ydah ydah closed this as completed in #97 Jan 5, 2024
ydah added a commit that referenced this issue Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants