You’ve probably used Rails fixtures or factory_bot to set up an object for testing purposes. But this can be too much when you’re just testing a simple data object. I like to reach for this little helper: def build_user(**) = User.new( name: "Joel", email: "joel@example.com", ** )
Little factories
Little factories
Little factories
You’ve probably used Rails fixtures or factory_bot to set up an object for testing purposes. But this can be too much when you’re just testing a simple data object. I like to reach for this little helper: def build_user(**) = User.new( name: "Joel", email: "joel@example.com", ** )