Last active
November 13, 2020 05:33
-
-
Save r7kamura/89c6b0f09b6c3aa25a138649ae0e810f to your computer and use it in GitHub Desktop.
Example to lint FactoryBot factories with RSpec.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe 'FactoryBot factory' do | |
FactoryBot.factories.each do |factory| | |
describe factory.name.inspect do | |
it 'creates valid record' do | |
expect { FactoryBot::Linter.new([factory]).lint! }.not_to raise_error | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment