Skip to content

Instantly share code, notes, and snippets.

@r7kamura
Last active November 13, 2020 05:33
Show Gist options
  • Save r7kamura/89c6b0f09b6c3aa25a138649ae0e810f to your computer and use it in GitHub Desktop.
Save r7kamura/89c6b0f09b6c3aa25a138649ae0e810f to your computer and use it in GitHub Desktop.
Example to lint FactoryBot factories with RSpec.
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