Created
April 8, 2023 23:32
-
-
Save kluzny/185f08ecb0f8956a1f99b575b7bd65e8 to your computer and use it in GitHub Desktop.
automatically test every factory build/create
This file contains hidden or 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' | |
FactoryBot.factories.map(&:name).each do |factory_name| | |
describe "The #{factory_name} factory" do | |
it 'is valid' do | |
expect(build(factory_name)).to be_valid | |
end | |
it 'creates without error' do | |
expect { create(factory_name) }.to_not raise_error | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment