thoughtbot / factory_bot

A library for setting up Ruby objects as test data.
https://thoughtbot.com
MIT License
7.9k stars 2.6k forks source link

recommended fix for static attributes doesn't seem to work #1302

Closed josh-m-sharpe closed 5 years ago

josh-m-sharpe commented 5 years ago
$ rubocop \
>   --require rubocop-rspec \
>   --only FactoryBot/AttributeDefinedStatically \
>   --auto-correct
Inspecting 1025 files
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

1025 files inspected, no offenses detected

$ cat test/factories/info_pages.rb
FactoryBot.define do
  factory :info_page do
    organization

    title 'About US'
    body 'test'
  end
end
josh-m-sharpe commented 5 years ago

factory bot version: 4.11.1

composerinteralia commented 5 years ago

https://github.com/thoughtbot/factory_bot/issues/1173 may help

composerinteralia commented 5 years ago

@josh-m-sharpe were you able to sort this out with the issue I linked to?

josh-m-sharpe commented 5 years ago

To be honest, I kinda glossed over it as this project doesn't use rpsec and doesn't have rubocop installed. Also, I had already manually gone through and updated all my factories.

composerinteralia commented 5 years ago

Got it. Thanks for getting back to me. There is a comment in #1173 about how to get the cop working with non-rspec suites, but I think the experience is a bit awkward for non-rspec users. Since we have #1173 to track that issue, I am going to close this one. Thanks for taking the time to open this!