rubocop-rspec
rubocop-rspec copied to clipboard
Cop Idea: use fixture_path
We've got a lot of places in our codebase where people do:
# bad
Rails.root.join('spec', 'fixtures', 'something.pdf')
It would be great to have a cop to enforce using RSpec.configuration.fixture_path:
# good
File.join(fixture_path, 'something.pdf')
Sounds reasonable to me. I personally wont use this so I won't implement it but I'd accept a PR for this.
This one seems better to suggest using file_fixture now.
https://relishapp.com/rspec/rspec-rails/v/3-5/docs/file-fixture
And I think this one would be better named RSpec/Rails/FileFixture.